GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( d9a634...e591c7 )
by Juan Jose
07:17 queued 16s
created
src/Route4Me/V5/Routes/RouteParameters.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -7,89 +7,89 @@
 block discarded – undo
7 7
 
8 8
 class RouteParameters extends Common
9 9
 {
10
-    public $is_upload;
11
-    public $rt;
12
-    public $route_name;
13
-    public $route_date;
14
-    public $shared_publicly;
15
-    public $disable_optimization;
16
-    public $optimize;
17
-    public $lock_last;
18
-    public $vehicle_capacity;
19
-    public $vehicle_max_cargo_weight;
20
-    public $vehicle_max_cargo_volume;
21
-    public $vehicle_max_distance_mi;
22
-    public $subtour_max_revenue;
23
-    public $distance_unit;
24
-    public $travel_mode;
25
-    public $avoid;
26
-    public $avoidance_zones = [];
27
-    public $vehicle_id;
28
-    public $driver_id;
29
-    public $dev_lat;
30
-    public $dev_lng;
31
-    public $route_max_duration;
32
-    public $route_email;
33
-    public $store_route;
34
-    public $metric;
35
-    public $algorithm_type;
36
-    public $member_id;
37
-    public $ip;
38
-    public $dm;
39
-    public $dirm;
40
-    public $parts;
41
-    public $parts_min;
42
-    public $device_id;
43
-    public $device_type;
44
-    public $first_drive_then_wait_between_stops;
45
-    public $has_trailer;
46
-    public $trailer_weight_t;
47
-    public $limited_weight_t;
48
-    public $weight_per_axle_t;
49
-    public $truck_height;
50
-    public $truck_width;
51
-    public $truck_length;
52
-    public $truck_hazardous_goods;
53
-    public $truck_axles;
54
-    public $truck_toll_road_usage;
55
-    public $truck_avoid_ferries;
56
-    public $truck_hwy_only;
57
-    public $truck_lcv;
58
-    public $truck_borders;
59
-    public $truck_side_street_adherence;
60
-    public $truck_config;
61
-    public $truck_dim_unit;
62
-    public $truck_type;
63
-    public $truck_weight;
64
-    public $optimization_quality;
65
-    public $override_addresses = [];
66
-    public $max_tour_size;
67
-    public $min_tour_size;
68
-    public $uturn;
69
-    public $leftturn;
70
-    public $rightturn;
71
-    public $route_time_multiplier;
72
-    public $route_service_time_multiplier;
73
-    public $optimization_engine;
74
-    public $is_dynamic_start_time;
75
-    public $bundling;
10
+	public $is_upload;
11
+	public $rt;
12
+	public $route_name;
13
+	public $route_date;
14
+	public $shared_publicly;
15
+	public $disable_optimization;
16
+	public $optimize;
17
+	public $lock_last;
18
+	public $vehicle_capacity;
19
+	public $vehicle_max_cargo_weight;
20
+	public $vehicle_max_cargo_volume;
21
+	public $vehicle_max_distance_mi;
22
+	public $subtour_max_revenue;
23
+	public $distance_unit;
24
+	public $travel_mode;
25
+	public $avoid;
26
+	public $avoidance_zones = [];
27
+	public $vehicle_id;
28
+	public $driver_id;
29
+	public $dev_lat;
30
+	public $dev_lng;
31
+	public $route_max_duration;
32
+	public $route_email;
33
+	public $store_route;
34
+	public $metric;
35
+	public $algorithm_type;
36
+	public $member_id;
37
+	public $ip;
38
+	public $dm;
39
+	public $dirm;
40
+	public $parts;
41
+	public $parts_min;
42
+	public $device_id;
43
+	public $device_type;
44
+	public $first_drive_then_wait_between_stops;
45
+	public $has_trailer;
46
+	public $trailer_weight_t;
47
+	public $limited_weight_t;
48
+	public $weight_per_axle_t;
49
+	public $truck_height;
50
+	public $truck_width;
51
+	public $truck_length;
52
+	public $truck_hazardous_goods;
53
+	public $truck_axles;
54
+	public $truck_toll_road_usage;
55
+	public $truck_avoid_ferries;
56
+	public $truck_hwy_only;
57
+	public $truck_lcv;
58
+	public $truck_borders;
59
+	public $truck_side_street_adherence;
60
+	public $truck_config;
61
+	public $truck_dim_unit;
62
+	public $truck_type;
63
+	public $truck_weight;
64
+	public $optimization_quality;
65
+	public $override_addresses = [];
66
+	public $max_tour_size;
67
+	public $min_tour_size;
68
+	public $uturn;
69
+	public $leftturn;
70
+	public $rightturn;
71
+	public $route_time_multiplier;
72
+	public $route_service_time_multiplier;
73
+	public $optimization_engine;
74
+	public $is_dynamic_start_time;
75
+	public $bundling;
76 76
 
77
-    public function setAddressBundle($addressBundle)
78
-    {
79
-        $this->bundling = $addressBundle;
80
-    }
77
+	public function setAddressBundle($addressBundle)
78
+	{
79
+		$this->bundling = $addressBundle;
80
+	}
81 81
 
82
-    public function getAddressBundle()
83
-    {
84
-        return $this->bundling;
85
-    }
82
+	public function getAddressBundle()
83
+	{
84
+		return $this->bundling;
85
+	}
86 86
 
87
-    public static function getAllProperties()
88
-    {
89
-        $routeParams = new self();
87
+	public static function getAllProperties()
88
+	{
89
+		$routeParams = new self();
90 90
 
91
-        $fields = array_keys(get_object_vars($routeParams));
91
+		$fields = array_keys(get_object_vars($routeParams));
92 92
 
93
-        return $fields;
94
-    }
93
+		return $fields;
94
+	}
95 95
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Members/DriverRatingApi/DriverReview.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,29 +9,29 @@
 block discarded – undo
9 9
  */
10 10
 class DriverReview extends \Route4Me\Common
11 11
 {
12
-    /** Driver Rating ID
13
-     * @var string $rating_id
14
-     */
15
-    public $rating_id;
12
+	/** Driver Rating ID
13
+	 * @var string $rating_id
14
+	 */
15
+	public $rating_id;
16 16
 
17
-    /** The tracking number of the route destination
18
-     * @var string $tracking_number
19
-     */
20
-    public $tracking_number;
17
+	/** The tracking number of the route destination
18
+	 * @var string $tracking_number
19
+	 */
20
+	public $tracking_number;
21 21
 
22
-    /**  review the driver got
23
-     * @var string $review
24
-     */
25
-    public $review;
22
+	/**  review the driver got
23
+	 * @var string $review
24
+	 */
25
+	public $review;
26 26
 
27
-    /** The rating assigned to the driver.
28
-     * Available values: 1,2,3,4
29
-     * @var integer $rating
30
-     */
31
-    public $rating;
27
+	/** The rating assigned to the driver.
28
+	 * Available values: 1,2,3,4
29
+	 * @var integer $rating
30
+	 */
31
+	public $rating;
32 32
 
33
-    /** When the review was created.
34
-     * @var string $added_at
35
-     */
36
-    public $added_at;
33
+	/** When the review was created.
34
+	 * @var string $added_at
35
+	 */
36
+	public $added_at;
37 37
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Members/DriverRatingApi/SimplePaginationData.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@
 block discarded – undo
10 10
  */
11 11
 class SimplePaginationData extends \Route4Me\Common
12 12
 {
13
-    /** Driver reviews number per page.
14
-     * @var integer $per_page
15
-     */
16
-    public $per_page;
17
-
18
-    /** Current page number in the driver reviews collection.
19
-     * @var integer $current_page
20
-     */
21
-    public $current_page;
22
-
23
-    /** Path to the driver review addon.
24
-     * @var string $path
25
-     */
26
-    public $path;
27
-
28
-    /** Path to the first page of the driver reviews collection.
29
-     * @var string $first
30
-     */
31
-    public $first;
32
-
33
-    /** Path to the previous page of the driver reviews collection.
34
-     * @var string $prev
35
-     */
36
-    public $prev;
37
-
38
-    /** Path to the next page of the driver reviews collection.
39
-     * @var string $next
40
-     */
41
-    public $next;
13
+	/** Driver reviews number per page.
14
+	 * @var integer $per_page
15
+	 */
16
+	public $per_page;
17
+
18
+	/** Current page number in the driver reviews collection.
19
+	 * @var integer $current_page
20
+	 */
21
+	public $current_page;
22
+
23
+	/** Path to the driver review addon.
24
+	 * @var string $path
25
+	 */
26
+	public $path;
27
+
28
+	/** Path to the first page of the driver reviews collection.
29
+	 * @var string $first
30
+	 */
31
+	public $first;
32
+
33
+	/** Path to the previous page of the driver reviews collection.
34
+	 * @var string $prev
35
+	 */
36
+	public $prev;
37
+
38
+	/** Path to the next page of the driver reviews collection.
39
+	 * @var string $next
40
+	 */
41
+	public $next;
42 42
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/TelematicsVendorFeature.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,27 +9,27 @@
 block discarded – undo
9 9
  */
10 10
 class TelematicsVendorFeature extends Common
11 11
 {
12
-    /**
13
-     * Feature ID
14
-     * @var type string
15
-     */
16
-    public $id;
12
+	/**
13
+	 * Feature ID
14
+	 * @var type string
15
+	 */
16
+	public $id;
17 17
    
18 18
    /**
19 19
     * Feature name
20 20
     * @var type string
21 21
     */
22
-    public $name;
22
+	public $name;
23 23
    
24 24
    /**
25 25
     * Feature slug
26 26
     * @var type string
27 27
     */
28
-    public $slug;
28
+	public $slug;
29 29
    
30 30
    /**
31 31
     * Feature group
32 32
     * @var type string
33 33
     */
34
-    public $feature_group;
34
+	public $feature_group;
35 35
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/AccountProfile.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,33 +9,33 @@
 block discarded – undo
9 9
  */
10 10
 class AccountProfile extends Common
11 11
 {
12
-    /**
13
-     * Account profile email
14
-     * @var type string
15
-     */
16
-    public $email;
12
+	/**
13
+	 * Account profile email
14
+	 * @var type string
15
+	 */
16
+	public $email;
17 17
     
18
-    /**
19
-     * Account member ID
20
-     * @var type integer
21
-     */
22
-    public $member_id;
18
+	/**
19
+	 * Account member ID
20
+	 * @var type integer
21
+	 */
22
+	public $member_id;
23 23
     
24
-    /**
25
-     * Account API key
26
-     * @var type string
27
-     */
28
-    public $api_key;
24
+	/**
25
+	 * Account API key
26
+	 * @var type string
27
+	 */
28
+	public $api_key;
29 29
     
30
-    /**
31
-     * Account root member ID
32
-     * @var type integer
33
-     */
34
-    public $root_member_id;
30
+	/**
31
+	 * Account root member ID
32
+	 * @var type integer
33
+	 */
34
+	public $root_member_id;
35 35
     
36
-    /**
37
-     * Preferred units of the account.
38
-     * @var type string
39
-     */
40
-    public $preferred_units;
36
+	/**
37
+	 * Preferred units of the account.
38
+	 * @var type string
39
+	 */
40
+	public $preferred_units;
41 41
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Country.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@
 block discarded – undo
9 9
  */
10 10
 class Country extends Common
11 11
 {
12
-    /**
13
-     * Country ID
14
-     * @var type string
15
-     */
16
-    public $id;
12
+	/**
13
+	 * Country ID
14
+	 * @var type string
15
+	 */
16
+	public $id;
17 17
     
18
-    /**
19
-     * Country code
20
-     * @var type string
21
-     */
22
-    public $country_code;
18
+	/**
19
+	 * Country code
20
+	 * @var type string
21
+	 */
22
+	public $country_code;
23 23
     
24
-    /**
25
-     * Country name
26
-     * @var type string
27
-     */
28
-    public $country_name;
24
+	/**
25
+	 * Country name
26
+	 * @var type string
27
+	 */
28
+	public $country_name;
29 29
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/AddressBook/AddressBook.php 2 patches
Indentation   +922 added lines, -922 removed lines patch added patch discarded remove patch
@@ -20,926 +20,926 @@
 block discarded – undo
20 20
  */
21 21
 class AddressBook extends Common
22 22
 {
23
-    public function __construct()
24
-    {
25
-        Route4Me::setBaseUrl('');
26
-    }
27
-
28
-    /**
29
-     * Get all Addresses filtered by specifying the corresponding query parameters.
30
-     *
31
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
32
-     *
33
-     * @param  array [$options]            - Array of options.
34
-     *   string [fields]                   - Comma-delimited list of the address
35
-     *                                       fields to be included into the search results
36
-     *                                       e.g., 'address_id, address_alias, address_1'.
37
-     *   string [display = 'all']          - Specify which Addresses to show in the
38
-     *                                       corresponding query results.
39
-     *                                       Possible values:
40
-     *                                         'all' - all records;
41
-     *                                         'routed' - only routed records;
42
-     *                                         'unrouted' - only unrouted records.
43
-     *   string [query]                    - Search in the Addresses by the
44
-     *                                       corresponding query phrase.
45
-     *   int    [limit]                    - Limit of the queried records number.
46
-     *   int    [offset]                   - Offset from the beginning of the queried records.
47
-     * @return ResponseAll
48
-     * @throws Exception\ApiError
49
-     */
50
-    public function getAddresses(?array $options = null) : ResponseAll
51
-    {
52
-        $allQueryFields = ['fields', 'display', 'query', 'limit', 'offset'];
53
-
54
-        return $this->toResponseAll(Route4Me::makeRequst([
55
-            'url' => Endpoint::ADDRESSES_INDEX_ALL,
56
-            'method' => 'GET',
57
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
58
-        ]));
59
-    }
60
-
61
-    /**
62
-     * Get all Addresses filtered and sorted by sending the corresponding body payload, with
63
-     * the option to search by the specified areas.
64
-     *
65
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
66
-     *
67
-     * @param  array [$options]            - Array of options.
68
-     *   array  [fields = []]              - An array of the fields to be included
69
-     *                                       in the search result.
70
-     *                                       e.g., ['address_id', 'address_alias', 'address_1'].
71
-     *   array  [filter]                   - FIlter parameters
72
-     *     string [query]                  - Query string.
73
-     *     array  [selected_areas]         - Selected areas
74
-     *       string [type]                 - Area type.
75
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
76
-     *       array  [value]                - Area parameters.
77
-     *         e.g.,
78
-     *         'type' => 'circle',
79
-     *         'value' => [
80
-     *             'center' => ['lat' => 40, 'lng' => 80],
81
-     *             'distance' => 1000
82
-     *         ]
83
-     *
84
-     *         'type' => 'polygon',
85
-     *         'value' => [
86
-     *             'points' => [[74, 40], [88, 30], [90, 25]]
87
-     *         ]
88
-     *
89
-     *         'type' => 'rect',
90
-     *         'value' => [
91
-     *             'top_left' => [50, 90],
92
-     *             'bottom_right' => [48, 70]
93
-     *         ]
94
-     *
95
-     *     array  [bounding_box]           - Coordinates of bounding box
96
-     *       float [top]                   - Top
97
-     *       float [left]                  - Left
98
-     *       float [bottom                 - Bottom
99
-     *       float [right]                 - Right
100
-     *
101
-     *     array  [center]                 - GPS coordinates of central point.
102
-     *       float [lat]                   - Latitude.
103
-     *       float [lng]                   - Longitude.
104
-     *     float  [distance]               - Distance from the area center.
105
-     *     string [display]                - Display option of the contacts.
106
-     *                                       Possible values:
107
-     *                                         'all' - all records;
108
-     *                                         'routed' - only routed records;
109
-     *                                         'unrouted' - only unrouted records.
110
-     *     float  [assigned_member_id]     - A member the contact assigned to.
111
-     *     float  [is_assigned]            - If true, the contact assigned to a member.
112
-     *   array  [order_by]                 - Array of order fields
113
-     *                                       You can sort the results using the specified fields:
114
-     *                                       address_1, address_alias, first_name, last_name,
115
-     *                                       address_phone_number, address_email, address_group,
116
-     *                                       in_route_count, visited_count, last_visited_timestamp,
117
-     *                                       last_routed_timestamp
118
-     *                                       e.g., [["address_1", "asc"], ["last_name", "desc"]]
119
-     *
120
-     *   int    [limit]                    - Limit of the queried records number.
121
-     *   int    [offset]                   - Offset from the beginning of the queried records.
122
-     * @return ResponseAll
123
-     * @throws Exception\ApiError
124
-     */
125
-    public function getAddressesByBodyPayload(?array $options = null) : ResponseAll
126
-    {
127
-        $allBodyFields = ['fields', 'filter', 'order_by', 'limit', 'offset'];
128
-
129
-        return $this->toResponseAll(Route4Me::makeRequst([
130
-            'url' => Endpoint::ADDRESSES_INDEX_ALL,
131
-            'method' => 'POST',
132
-            'HTTPHEADER' => 'Content-Type: application/json',
133
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
134
-        ]));
135
-    }
136
-
137
-    /**
138
-     * Get a paginated list of all Addresses.
139
-     *
140
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
141
-     *
142
-     * @param  array [$options]            - Array of options.
143
-     *   string [fields]                   - Comma-delimited list of the address
144
-     *                                       fields to be included into the search results
145
-     *                                       e.g., 'address_id, address_alias, address_1'.
146
-     *   string [display = 'all']          - Specify which Addresses to show in the
147
-     *                                       corresponding query results.
148
-     *                                       Possible values:
149
-     *                                         'all' - all records;
150
-     *                                         'routed' - only routed records;
151
-     *                                         'unrouted' - only unrouted records.
152
-     *   string [query]                    - Search in the Addresses by the
153
-     *                                       corresponding query phrase.
154
-     *   int    [page = 1]                 - Requested page.
155
-     *   int    [per_page = 30]            - Number of Addresses per page.
156
-     * @return ResponsePagination
157
-     * @throws Exception\ApiError
158
-     */
159
-    public function getAddressesPaginated(?array $options = null) : ResponsePagination
160
-    {
161
-        $allQueryFields = ['fields', 'display', 'query', 'page', 'per_page'];
162
-
163
-        return $this->toResponsePagination(Route4Me::makeRequst([
164
-            'url' => Endpoint::ADDRESSES_INDEX_PAGINATION,
165
-            'method' => 'GET',
166
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
167
-        ]));
168
-    }
169
-
170
-    /**
171
-     * Get the paginated list of all Addresses filtered and sorted by sending the corresponding
172
-     * body payload, with the option to search by the specified areas.
173
-     *
174
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
175
-     *
176
-     * @param  array [$options]            - Array of options.
177
-     *   array  [fields = []]              - An array of the fields to be included
178
-     *                                       in the search result.
179
-     *                                       e.g., ['address_id', 'address_alias', 'address_1'].
180
-     *   array  [filter]                   - FIlter parameters
181
-     *     string [query]                  - Query string.
182
-     *     array  [selected_areas]         - Selected areas
183
-     *       string [type]                 - Area type.
184
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
185
-     *       array  [value]                - Area parameters.
186
-     *         e.g.,
187
-     *         'type' => 'circle',
188
-     *         'value' => [
189
-     *             'center' => ['lat' => 40, 'lng' => 80],
190
-     *             'distance' => 1000
191
-     *         ]
192
-     *
193
-     *         'type' => 'polygon',
194
-     *         'value' => [
195
-     *             'points' => [[74, 40], [88, 30], [90, 25]]
196
-     *         ]
197
-     *
198
-     *         'type' => 'rect',
199
-     *         'value' => [
200
-     *             'top_left' => [50, 90],
201
-     *             'bottom_right' => [48, 70]
202
-     *         ]
203
-     *
204
-     *     array  [bounding_box]           - Coordinates of bounding box
205
-     *       float [top]                   - Top
206
-     *       float [left]                  - Left
207
-     *       float [bottom                 - Bottom
208
-     *       float [right]                 - Right
209
-     *
210
-     *     array  [center]                 - GPS coordinates of central point.
211
-     *       float [lat]                   - Latitude.
212
-     *       float [lng]                   - Longitude.
213
-     *     float  [distance]               - Distance from the area center.
214
-     *     string [display]                - Display option of the contacts.
215
-     *                                       Possible values:
216
-     *                                         'all' - all records;
217
-     *                                         'routed' - only routed records;
218
-     *                                         'unrouted' - only unrouted records.
219
-     *     float  [assigned_member_id]     - A member the contact assigned to.
220
-     *     float  [is_assigned]            - If true, the contact assigned to a member.
221
-     *   array  [order_by]                 - Array of order fields
222
-     *                                       You can sort the results using the specified fields:
223
-     *                                       address_1, address_alias, first_name, last_name,
224
-     *                                       address_phone_number, address_email, address_group,
225
-     *                                       in_route_count, visited_count, last_visited_timestamp,
226
-     *                                       last_routed_timestamp
227
-     *                                       e.g., [["address_1", "asc"], ["last_name", "desc"]]
228
-     *
229
-     *   int    [page = 1]                 - Page number.
230
-     *   int    [per_page = 30]            - Records number per page.
231
-     * @return ResponsePagination
232
-     * @throws Exception\ApiError
233
-     */
234
-    public function getAddressesPaginatedByBodyPayload(?array $options = null) : ResponsePagination
235
-    {
236
-        $allBodyFields = ['fields', 'filter', 'order_by', 'page', 'per_page'];
237
-
238
-        return $this->toResponsePagination(Route4Me::makeRequst([
239
-            'url' => Endpoint::ADDRESSES_INDEX_PAGINATION,
240
-            'method' => 'POST',
241
-            'HTTPHEADER' => 'Content-Type: application/json',
242
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
243
-        ]));
244
-    }
245
-
246
-    /**
247
-     * Get the Address clusters filtered by the corresponding query text, and with the option
248
-     * to filter the result by the 'routed' and 'unrouted' state.
249
-     *
250
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
251
-     *
252
-     * @param  array [$options]            - Array of options.
253
-     *   string [display = 'all']          - Specify which Addresses to show in the
254
-     *                                       corresponding query results.
255
-     *                                       Possible values:
256
-     *                                         'all' - all records;
257
-     *                                         'routed' - only routed records;
258
-     *                                         'unrouted' - only unrouted records.
259
-     *   string [query]                    - Search in the Addresses by the
260
-     * @return ResponseClustering
261
-     * @throws Exception\ApiError
262
-     */
263
-    public function getAddressClusters(?array $options = null) : ResponseClustering
264
-    {
265
-        $allQueryFields = ['display', 'query'];
266
-
267
-        return $this->toResponseClustering(Route4Me::makeRequst([
268
-            'url' => Endpoint::ADDRESSES_INDEX_CLUSTERING,
269
-            'method' => 'GET',
270
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
271
-        ]));
272
-    }
273
-
274
-    /**
275
-     * Get the Address clusters by sending the corresponding body payload.
276
-     *
277
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
278
-     *
279
-     * @param  array [$options]            - Array of options.
280
-     *   array [clustering]                - Clustering
281
-     *     int    [precision = 5]          - Clusering precision.
282
-     *                                       Possible values from 1 to 12.
283
-     *   array  [filter]                   - FIlter parameters
284
-     *     string [query]                  - Query string.
285
-     *     array  [selected_areas]         - Selected areas
286
-     *       string [type]                 - Area type.
287
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
288
-     *       array  [value]                - Area parameters.
289
-     *         e.g.,
290
-     *         'type' => 'circle',
291
-     *         'value' => [
292
-     *             'center' => ['lat' => 40, 'lng' => 80],
293
-     *             'distance' => 1000
294
-     *         ]
295
-     *
296
-     *         'type' => 'polygon',
297
-     *         'value' => [
298
-     *             'points' => [[74, 40], [88, 30], [90, 25]]
299
-     *         ]
300
-     *
301
-     *         'type' => 'rect',
302
-     *         'value' => [
303
-     *             'top_left' => [50, 90],
304
-     *             'bottom_right' => [48, 70]
305
-     *         ]
306
-     *
307
-     *     array  [bounding_box]           - Coordinates of bounding box
308
-     *       float [top]                   - Top
309
-     *       float [left]                  - Left
310
-     *       float [bottom                 - Bottom
311
-     *       float [right]                 - Right
312
-     *
313
-     *     array  [center]                 - GPS coordinates of central point.
314
-     *       float [lat]                   - Latitude.
315
-     *       float [lng]                   - Longitude.
316
-     *     float  [distance]               - Distance from the area center.
317
-     *     string [display]                - Display option of the contacts.
318
-     *                                       Possible values:
319
-     *                                         'all' - all records;
320
-     *                                         'routed' - only routed records;
321
-     *                                         'unrouted' - only unrouted records.
322
-     *     float  [assigned_member_id]     - A member the contact assigned to.
323
-     *     float  [is_assigned]            - If true, the contact assigned to a member.
324
-     * @return ResponseClustering
325
-     * @throws Exception\ApiError
326
-     */
327
-    public function getAddressClustersByBodyPayload(?array $options = null) : ResponseClustering
328
-    {
329
-        $allBodyFields = ['clustering', 'filter'];
330
-
331
-        return $this->toResponseClustering(Route4Me::makeRequst([
332
-            'url' => Endpoint::ADDRESSES_INDEX_CLUSTERING,
333
-            'method' => 'POST',
334
-            'HTTPHEADER' => 'Content-Type: application/json',
335
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
336
-        ]));
337
-    }
338
-
339
-    /**
340
-     * Find an Address by sending the 'address_id' query parameter.
341
-     *
342
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
343
-     *
344
-     * @param  int    $addressId           - The Address ID to be searched for.
345
-     * @return ResponseAddress
346
-     * @throws Exception\ApiError
347
-     */
348
-    public function getAddressById(int $addressId) : ResponseAddress
349
-    {
350
-        return $this->toResponseAddress(Route4Me::makeRequst([
351
-            'url' => Endpoint::ADDRESSES_SHOW,
352
-            'method' => 'GET',
353
-            'query' => ['address_id' => $addressId]
354
-        ]));
355
-    }
356
-
357
-    /**
358
-     * Find multiple Addresses by sending a body payload with the array of
359
-     * the corresponding Address IDs.
360
-     *
361
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
362
-     *
363
-     * @param  array  $addressIds          - The array of Address IDs to be searched for.
364
-     * @return ResponseAll
365
-     * @throws Exception\ApiError
366
-     */
367
-    public function getAddressesByIds(array $addressIds) : ResponseAll
368
-    {
369
-        return $this->toResponseAll(Route4Me::makeRequst([
370
-            'url' => Endpoint::ADDRESSES_SHOW,
371
-            'method' => 'POST',
372
-            'HTTPHEADER' => 'Content-Type: application/json',
373
-            'body' => ['address_ids' => $addressIds]
374
-        ]));
375
-    }
376
-
377
-    /**
378
-     * Add a new Address Book Contact by sending a body payload with the corresponding parameters.
379
-     *
380
-     * @see {@link https://route4me.io/docs/#create-a-location}
381
-     *
382
-     * @param  $params_or_address           - Array of address's parameters or Address object
383
-     *   string address_1                   - The route Address Line 1.
384
-     *   float  cached_lat                  - Cached latitude.
385
-     *   float  cached_lng                  - Cached longitude.
386
-     *   string address_stop_type           - The type of stop that this is one of:
387
-     *                                        'DELIVERY', 'PICKUP', 'BREAK', 'MEETUP',
388
-     *                                        'SERVICE', 'VISIT' or 'DRIVEBY'.
389
-     *   int    [created_timestamp]         - When the contact created.
390
-     *   string [address_2]                 - The route Address Line 2 which is not used for geocoding.
391
-     *   int    [member_id]                 - Address book contact owner ID.
392
-     *   string [address_zip]               - The zip code the address is located in.
393
-     *   string [address_group]             - Address group.
394
-     *   string [address_alias]             - Address alias.
395
-     *   string [address_city]              - The city the address is located in.
396
-     *   string [address_state_id]          - The state the address is located in.
397
-     *   string [address_country_id]        - The country the address is located in.
398
-     *   string [first_name]                - The first name of the receiving address.
399
-     *   string [last_name]                 - The last name of the receiving party.
400
-     *   string [address_email]             - Address email.
401
-     *   string [address_phone_number]      - The phone number for the address.
402
-     *   float  [curbside_lat]              - Curbside latitude.
403
-     *   float  [curbside_lng]              - Curbside longitude.
404
-     *   array  [address_custom_data]       - Array of Address custom data, as 'key' => value
405
-     *   int    [local_time_window_start]   - Time Window Start in seconds, relative to the route start
406
-     *                                        date (midnight), UTC time zone. It is relative to start
407
-     *                                        date because start time changes would shift time windows.
408
-     *   int    [local_time_window_end]     - Time Window End in seconds, relative to the route start
409
-     *                                        date (midnight), UTC time zone. It is relative to start
410
-     *                                        datebecause start time changes would shift time windows.
411
-     *   int    [local_time_window_start_2] - See local_time_window_start
412
-     *   int    [local_time_window_end_2]   - See local_time_window_end
413
-     *   string [local_timezone_string]     - Local timezone string
414
-     *   int    [service_time]              - Consumed service time at an address.
415
-     *   string [color]                     - Color of an address, e.g., 'FF0000'.
416
-     *   string [address_icon]              - URL to an address icon file.
417
-     *   array  [schedule[]]                - Array of array of the trip schedules to a location.
418
-     *     bool   [enabled]                 - If true, the schedule is enabled.
419
-     *     string [mode]                    - Schedule mode.
420
-     *     array  [monthly]                 - Monthly.
421
-     *       int    [every]                 - Every.
422
-     *   array  [schedule_blacklist]        - Array of the dates, which should be excluded from a trip
423
-     *                                        schedule to a location. Also can be a date string with
424
-     *                                        the 'YYYY-MM-DD' format or null.
425
-     *   float  [address_cube]              - The cubic volume of the cargo being delivered or picked
426
-     *                                        up at the address.
427
-     *   float  [address_pieces]            - The item quantity of the cargo being delivered or picked
428
-     *                                        up at the address.
429
-     *   string [address_reference_no]      - The reference number for the address.
430
-     *   float  [address_revenue]           - The total revenue for the address
431
-     *   float  [address_weight]            - Weight of the cargo being delivered or picked up
432
-     *                                        at the address.
433
-     *   int    [address_priority]          - Priority of address 0 is the highest priority,
434
-     *                                        n has higher priority than n + 1
435
-     *   string [address_customer_po]       - The customer purchase order for the address
436
-     *   bool   [eligible_pickup]           - If true, the address is eligible to pickup.
437
-     *   bool   [eligible_depot]            - If true, the addrss is eligible to depot.
438
-     *   array  [assigned_to]               - Assigned to
439
-     *     int    [member_id]               - A member the address assigned to.
440
-     *     string [member_first_name]       - Member first name.
441
-     *     string [member_last_name]        - Member last name.
442
-     *     string [member_email]            - Member email.
443
-     *     string [until]                   - The assignment is valid until to.
444
-     * @return ResponseAddress
445
-     * @throws Exception\ApiError
446
-     */
447
-    public function addAddress($params_or_address) : ResponseAddress
448
-    {
449
-        $allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
450
-            'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
451
-            'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
452
-            'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
453
-            'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
454
-            'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
455
-            'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
456
-            'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
457
-            'eligible_depot', 'assigned_to'
458
-        ];
459
-
460
-        return $this->toResponseAddress(Route4Me::makeRequst([
461
-            'url' => Endpoint::ADDRESSES,
462
-            'method' => 'POST',
463
-            'HTTPHEADER' => 'Content-Type: application/json',
464
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params_or_address)
465
-        ]));
466
-    }
467
-
468
-    /**
469
-     * Add multiple new Address Book Contacts by sending a body payload with the array of
470
-     * the corresponding Address parameters.
471
-     *
472
-     * @see {@link https://route4me.io/docs/#create-a-location}
473
-     *
474
-     * @param  array  $arr                 - Array of Address for more information look addAddress.
475
-     * @return bool
476
-     * @throws Exception\ApiError
477
-     */
478
-    public function addMultipleAddresses($arr) : bool
479
-    {
480
-        $allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
481
-            'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
482
-            'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
483
-            'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
484
-            'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
485
-            'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
486
-            'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
487
-            'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
488
-            'eligible_depot', 'assigned_to'
489
-        ];
490
-
491
-        $data = [];
492
-        foreach ($arr as $key => $value) {
493
-            $data[] = Route4Me::generateRequestParameters($allBodyFields, $value);
494
-        }
495
-
496
-        $result = Route4Me::makeRequst([
497
-            'url' => Endpoint::ADDRESSES_BATCH_CREATE,
498
-            'method' => 'POST',
499
-            'HTTPHEADER' => 'Content-Type: application/json',
500
-            'body' => ['data' => $data]
501
-        ]);
502
-
503
-        if (is_array($result) && isset($result['status'])) {
504
-            return (bool)$result['status'];
505
-        }
506
-        return false;
507
-    }
508
-
509
-    /**
510
-     * Update the Address Book Contact by specifying the 'address_id' path parameter
511
-     * and by sending a body payload with the corresponding Address parameters.
512
-     *
513
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
514
-     *
515
-     * @param  int    $addressId           - The Address ID to update.
516
-     * @param  array  $params              - Parameters of address to update, for more
517
-     *                                       information look addAddress
518
-     * @return ResponseAddress
519
-     * @throws Exception\ApiError
520
-     */
521
-    public function updateAddressById(int $addressId, $params) : ResponseAddress
522
-    {
523
-        $allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
524
-            'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
525
-            'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
526
-            'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
527
-            'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
528
-            'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
529
-            'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
530
-            'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
531
-            'eligible_depot', 'assigned_to'
532
-        ];
533
-
534
-        return $this->toResponseAddress(Route4Me::makeRequst([
535
-            'url' => Endpoint::ADDRESSES . '/' . $addressId,
536
-            'method' => 'PUT',
537
-            'HTTPHEADER' => 'Content-Type: application/json',
538
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
539
-        ]));
540
-    }
541
-
542
-    /**
543
-     * Update multiple Address Book Contacts by sending a body payload with the array
544
-     * of the corresponding Address IDs and Address parameters.
545
-     *
546
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
547
-     *
548
-     * @param  array $address_ids           - An array of the address IDs (int).
549
-     * @param  $params_or_updateAddress     - Array of addresses parameters or "UpdateAddress" object
550
-     *                                        for more information look addAddress, requires only
551
-     *                                        one parameter service_time, all other are optional.
552
-     * @return ResponseAddress[]
553
-     * @throws Exception\ApiError
554
-     */
555
-    public function updateAddressesByIds(array $address_ids, $params_or_updateAddress) : array
556
-    {
557
-        $allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
558
-            'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
559
-            'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
560
-            'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
561
-            'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
562
-            'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
563
-            'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
564
-            'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
565
-            'eligible_depot'
566
-        ];
567
-
568
-        $params = Route4Me::generateRequestParameters($allBodyFields, $params_or_updateAddress);
569
-        $params['address_ids'] = $address_ids;
570
-
571
-        $result = Route4Me::makeRequst([
572
-            'url' => Endpoint::ADDRESSES_BATCH_UPDATE,
573
-            'method' => 'PUT',
574
-            'HTTPHEADER' => 'Content-Type: application/json',
575
-            'body' => $params
576
-        ]);
577
-
578
-        if (is_array($result)) {
579
-            $data = [];
580
-            foreach ($result as $key => $value) {
581
-                $data[] = $this->toResponseAddress($value);
582
-            }
583
-            return $data;
584
-        }
585
-        return [];
586
-    }
587
-
588
-    /**
589
-     * Update Address Book Contacts by sending a body payload with the corresponding query
590
-     * text and specified territory areas.
591
-     *
592
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
593
-     *
594
-     * @todo request has uncheckable result - 403 forbidden
595
-     *
596
-     * @param  array  $filter              - FIlter parameters
597
-     *   string [query]                    - Search in the Addresses by the query phrase.
598
-     *   array  [bounding_box]             - Coordinates of bounding box
599
-     *     float [top]                     - Top
600
-     *     float [left]                    - Left
601
-     *     float [bottom                   - Bottom
602
-     *     float [right]                   - Right
603
-     *   array  [selected_areas]           - Selected areas
604
-     *     string [type]                   - Area type.
605
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
606
-     *     array  [value]                  - Area parameters.
607
-     *       e.g.,
608
-     *       'type' => 'circle',
609
-     *       'value' => [
610
-     *           'center' => ['lat' => 40, 'lng' => 80],
611
-     *           'distance' => 1000
612
-     *       ]
613
-     *
614
-     *       'type' => 'polygon',
615
-     *       'value' => [
616
-     *           'points' => [[74, 40], [88, 30], [90, 25]]
617
-     *       ]
618
-     *
619
-     *       'type' => 'rect',
620
-     *       'value' => [
621
-     *           'top_left' => [50, 90],
622
-     *           'bottom_right' => [48, 70]
623
-     *       ]
624
-     * @param  array  $params               - Parameters of address to update, for more
625
-     *                                        information look addAddresses
626
-     *   string [address_group]             - Address group.
627
-     *   string [address_alias]             - Address alias.
628
-     *   int    [member_id]                 - Address book contact owner ID.
629
-     *   string [first_name]                - The first name of the receiving address.
630
-     *   string [last_name]                 - The last name of the receiving party.
631
-     *   string [address_email]             - Address email.
632
-     *   string [address_phone_number]      - The phone number for the address.
633
-     *   array  [address_custom_data]       - Array of Address custom data, as 'key' => value
634
-     *   int    [local_time_window_start]   - Time Window Start in seconds, relative to the route start
635
-     *                                        date (midnight), UTC time zone. It is relative to start
636
-     *                                        date because start time changes would shift time windows.
637
-     *   int    [local_time_window_end]     - Time Window End in seconds, relative to the route start
638
-     *                                        date (midnight), UTC time zone. It is relative to start
639
-     *                                        datebecause start time changes would shift time windows.
640
-     *   int    [local_time_window_start_2] - See local_time_window_start
641
-     *   int    [local_time_window_end_2]   - See local_time_window_end
642
-     *   string [local_timezone_string]     - Local timezone string
643
-     *   int    [service_time]              - Consumed service time at an address.
644
-     *   string [color]                     - Color of an address, e.g., 'FF0000'.
645
-     *   string [address_icon]              - URL to an address icon file.
646
-     *   bool   [eligible_pickup]           - If true, the address is eligible to pickup.
647
-     *   bool   [eligible_depot]            - If true, the addrss is eligible to depot.
648
-     * @return StatusChecker
649
-     * @throws Exception\ApiError
650
-     */
651
-    public function updateAddressesByAreas(array $filter, array $params) : StatusChecker
652
-    {
653
-        $allFilterFields = ['query', 'bounding_box', 'selected_areas'];
654
-
655
-        $allParamsFields = ['member_id', 'address_group', 'address_alias', 'first_name', 'last_name',
656
-            'address_email', 'address_phone_number', 'address_custom_data', 'local_time_window_start',
657
-            'local_time_window_end', 'local_time_window_start_2', 'local_time_window_end_2',
658
-            'local_timezone_string', 'service_time', 'color', 'address_icon', 'eligible_pickup',
659
-            'eligible_depot'
660
-        ];
661
-
662
-        return new StatusChecker(Route4Me::makeRequst([
663
-            'url' => Endpoint::ADDRESSES_UPDATE_BY_AREAS,
664
-            'method' => 'PUT',
665
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
666
-            'return_headers' => ['location'],
667
-            'body' => [
668
-                'filter' => Route4Me::generateRequestParameters($allFilterFields, $filter),
669
-                'data' => Route4Me::generateRequestParameters($allParamsFields, $params)
670
-            ]
671
-        ]));
672
-    }
673
-
674
-    /**
675
-     * Delete multiple Address Book Contacts by sending a body payload with the
676
-     * array of the corresponding Address IDs.
677
-     *
678
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
679
-     *
680
-     * @param  array  addressIds           - The array of Address IDs to delete.
681
-     * @return StatusChecker
682
-     * @throws Exception\ApiError
683
-     */
684
-    public function deleteAddressesByIds(array $addressIds) : StatusChecker
685
-    {
686
-        return new StatusChecker(Route4Me::makeRequst([
687
-            'url' => Endpoint::ADDRESSES_DELETE,
688
-            'method' => 'DELETE',
689
-            'HTTPHEADER' => 'Content-Type: application/json',
690
-            'return_headers' => ['location', 'x-job-id'],
691
-            'body' => ['address_ids' => $addressIds]
692
-        ]));
693
-    }
694
-
695
-    /**
696
-     * Delete the Address Book Contacts located in the selected areas by sending
697
-     * the corresponding body payload.
698
-     *
699
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
700
-     *
701
-     * @todo request has uncheckable result - 403 forbidden
702
-     *
703
-     * @param  array  $filter              - FIlter parameters
704
-     *   string [query]                    - Search in the Addresses by the query phrase.
705
-     *   array  [bounding_box]             - Coordinates of bounding box
706
-     *     float [top]                     - Top
707
-     *     float [left]                    - Left
708
-     *     float [bottom                   - Bottom
709
-     *     float [right]                   - Right
710
-     *   array  [selected_areas]           - Selected areas
711
-     *     string [type]                   - Area type.
712
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
713
-     *     array  [value]                  - Area parameters.
714
-     *       e.g.,
715
-     *       'type' => 'circle',
716
-     *       'value' => [
717
-     *           'center' => ['lat' => 40, 'lng' => 80],
718
-     *           'distance' => 1000
719
-     *       ]
720
-     *
721
-     *       'type' => 'polygon',
722
-     *       'value' => [
723
-     *           'points' => [[74, 40], [88, 30], [90, 25]]
724
-     *       ]
725
-     *
726
-     *       'type' => 'rect',
727
-     *       'value' => [
728
-     *           'top_left' => [50, 90],
729
-     *           'bottom_right' => [48, 70]
730
-     *       ]
731
-     * @return StatusChecker
732
-     * @throws Exception\ApiError
733
-     */
734
-    public function deleteAddressesByAreas($filter) : StatusChecker
735
-    {
736
-        $allFilterFields = ['query', 'bounding_box', 'selected_areas'];
737
-
738
-        return new StatusChecker(Route4Me::makeRequst([
739
-            'url' => Endpoint::ADDRESSES_DELETE_BY_AREAS,
740
-            'method' => 'DELETE',
741
-            'return_headers' => ['location', 'x-job-id'],
742
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
743
-            'body' => ['filter' => Route4Me::generateRequestParameters($allFilterFields, $filter)]
744
-        ]));
745
-    }
746
-
747
-    /**
748
-     * Get all Address custom fields.
749
-     *
750
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
751
-     *
752
-     * @return array
753
-     * @throws Exception\ApiError
754
-     */
755
-    public function getAddressCustomFields() : array
756
-    {
757
-        return Route4Me::makeRequst([
758
-            'url' => Endpoint::ADDRESSES_CUSTOM_FIELDS,
759
-            'method' => 'GET'
760
-        ]);
761
-    }
762
-
763
-    /**
764
-     * Get depots Addresses.
765
-     *
766
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
767
-     *
768
-     * @return array
769
-     * @throws Exception\ApiError
770
-     */
771
-    public function getAddressesDepots() : array
772
-    {
773
-        return Route4Me::makeRequst([
774
-            'url' => Endpoint::ADDRESSES_DEPOTS,
775
-            'method' => 'GET'
776
-        ]);
777
-    }
778
-
779
-    /**
780
-     * Export Address Book Contacts to the specified file by sending a body
781
-     * payload with the array of the corresponding Address IDs.
782
-     *
783
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
784
-     *
785
-     * @param  array  addressIds           - Array of addresses ID to export.
786
-     * @param  string filename             - The name of the file to export.
787
-     * @return StatusChecker
788
-     * @throws Exception\ApiError
789
-     */
790
-    public function exportAddressesByIds(array $addressIds, string $filename) : StatusChecker
791
-    {
792
-        return new StatusChecker(Route4Me::makeRequst([
793
-            'url' => Endpoint::ADDRESSES_EXPORT,
794
-            'method' => 'POST',
795
-            'HTTPHEADER' => 'Content-Type: application/json',
796
-            'return_headers' => ['location'],
797
-            'body' => ['ids' => $addressIds, 'filename' => $filename]
798
-        ]));
799
-    }
800
-
801
-    /**
802
-     * Export the Address Book Contacts located in the selected areas
803
-     * by sending the corresponding body payload.
804
-     *
805
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
806
-     *
807
-     * @todo request has uncheckable result - 403 forbidden
808
-     *
809
-     * @param  array  $filter              - FIlter parameters
810
-     *   string [query]                    - Search in the Addresses by the query phrase.
811
-     *   array  [bounding_box]             - Coordinates of bounding box
812
-     *     float [top]                     - Top
813
-     *     float [left]                    - Left
814
-     *     float [bottom                   - Bottom
815
-     *     float [right]                   - Right
816
-     *   array  [selected_areas]           - Selected areas
817
-     *     string [type]                   - Area type.
818
-     *                                       Possible values: 'circle', 'polygon', 'rect'.
819
-     *     array  [value]                  - Area parameters.
820
-     *       e.g.,
821
-     *       'type' => 'circle',
822
-     *       'value' => [
823
-     *           'center' => ['lat' => 40, 'lng' => 80],
824
-     *           'distance' => 1000
825
-     *       ]
826
-     *
827
-     *       'type' => 'polygon',
828
-     *       'value' => [
829
-     *           'points' => [[74, 40], [88, 30], [90, 25]]
830
-     *       ]
831
-     *
832
-     *       'type' => 'rect',
833
-     *       'value' => [
834
-     *           'top_left' => [50, 90],
835
-     *           'bottom_right' => [48, 70]
836
-     *        ]
837
-     *   string filename                   - The name of the file to export.
838
-     * @return StatusChecker
839
-     * @throws Exception\ApiError
840
-     */
841
-    public function exportAddressesByAreas(array $filter) : StatusChecker
842
-    {
843
-        $allFilterFields = ['query', 'bounding_box', 'selected_areas', 'filename'];
844
-
845
-        return new StatusChecker(Route4Me::makeRequst([
846
-            'url' => Endpoint::ADDRESSES_EXPORT_BY_AREAS,
847
-            'method' => 'POST',
848
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
849
-            'return_headers' => ['location'],
850
-            'body' => ['filter' => Route4Me::generateRequestParameters($allFilterFields, $filter)]
851
-        ]));
852
-    }
853
-
854
-    /**
855
-     * Export Addresses by the specified area IDs.
856
-     *
857
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
858
-     *
859
-     * @todo request has uncheckable result - 403 forbidden
860
-     *
861
-     * @param  array  territoryIds         - An array of the territory IDs.
862
-     * @param  string filename             - The name of the file to export.
863
-     * @return StatusChecker
864
-     * @throws Exception\ApiError
865
-     */
866
-    public function exportAddressesByAreaIds(array $territoryIds, string $filename) : StatusChecker
867
-    {
868
-        return new StatusChecker(Route4Me::makeRequst([
869
-            'url' => Endpoint::ADDRESSES_EXPORT_BY_AREA_IDS,
870
-            'method' => 'POST',
871
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
872
-            'return_headers' => ['location'],
873
-            'body' => ['territory_ids' => $territoryIds, 'filename' => $filename]
874
-        ]));
875
-    }
876
-
877
-    /**
878
-     * Check the asynchronous job status by specifying the 'job_id' path parameter.
879
-     *
880
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
881
-     *
882
-     * @param  int    filename             - Job ID to check status.
883
-     * @return StatusChecker
884
-     * @throws Exception\ApiError
885
-     */
886
-    public function getAddressesAsynchronousJobStatus(string $jobId) : StatusChecker
887
-    {
888
-        return new StatusChecker(Route4Me::makeRequst([
889
-            'url' => Endpoint::ADDRESSES_JOB_TRACKER_STATUS . '/' . $jobId,
890
-            'method' => 'GET',
891
-            'HTTPHEADER' => 'Accept: application/json',
892
-            'return_headers' => ['X-R4M-Async-Job-Running-Time']
893
-        ]));
894
-    }
895
-
896
-    /**
897
-     * Get the asynchronous job result by specifying the 'job_id' path parameter.
898
-     *
899
-     * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
900
-     *
901
-     * @param  int    filename             - Job ID get result.
902
-     * @return bool
903
-     * @throws Exception\ApiError
904
-     */
905
-    public function getAddressesAsynchronousJobResult(string $jobId) : bool
906
-    {
907
-        $result = Route4Me::makeRequst([
908
-            'url' => Endpoint::ADDRESSES_JOB_TRACKER_RESULT . '/' . $jobId,
909
-            'method' => 'GET'
910
-        ]);
911
-        return (is_array($result) && isset($result['status']) && $result['status'] ? $result['status'] : false);
912
-    }
913
-
914
-    private function toResponseAddress($result) : ResponseAddress
915
-    {
916
-        if (is_array($result)) {
917
-            return new ResponseAddress($result);
918
-        }
919
-        throw new ApiError('Can not convert result to ResponseAddress object.');
920
-    }
921
-
922
-    private function toResponseAll($result) : ResponseAll
923
-    {
924
-        if (is_array($result)) {
925
-            return new ResponseAll($result);
926
-        }
927
-        throw new ApiError('Can not convert result to ResponseAll object.');
928
-    }
929
-
930
-    private function toResponsePagination($result) : ResponsePagination
931
-    {
932
-        if (is_array($result)) {
933
-            return new ResponsePagination($result);
934
-        }
935
-        throw new ApiError('Can not convert result to ResponsePagination object.');
936
-    }
937
-
938
-    private function toResponseClustering($result) : ResponseClustering
939
-    {
940
-        if (is_array($result)) {
941
-            return new ResponseClustering($result);
942
-        }
943
-        throw new ApiError('Can not convert result to ResponseClustering object.');
944
-    }
23
+	public function __construct()
24
+	{
25
+		Route4Me::setBaseUrl('');
26
+	}
27
+
28
+	/**
29
+	 * Get all Addresses filtered by specifying the corresponding query parameters.
30
+	 *
31
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
32
+	 *
33
+	 * @param  array [$options]            - Array of options.
34
+	 *   string [fields]                   - Comma-delimited list of the address
35
+	 *                                       fields to be included into the search results
36
+	 *                                       e.g., 'address_id, address_alias, address_1'.
37
+	 *   string [display = 'all']          - Specify which Addresses to show in the
38
+	 *                                       corresponding query results.
39
+	 *                                       Possible values:
40
+	 *                                         'all' - all records;
41
+	 *                                         'routed' - only routed records;
42
+	 *                                         'unrouted' - only unrouted records.
43
+	 *   string [query]                    - Search in the Addresses by the
44
+	 *                                       corresponding query phrase.
45
+	 *   int    [limit]                    - Limit of the queried records number.
46
+	 *   int    [offset]                   - Offset from the beginning of the queried records.
47
+	 * @return ResponseAll
48
+	 * @throws Exception\ApiError
49
+	 */
50
+	public function getAddresses(?array $options = null) : ResponseAll
51
+	{
52
+		$allQueryFields = ['fields', 'display', 'query', 'limit', 'offset'];
53
+
54
+		return $this->toResponseAll(Route4Me::makeRequst([
55
+			'url' => Endpoint::ADDRESSES_INDEX_ALL,
56
+			'method' => 'GET',
57
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
58
+		]));
59
+	}
60
+
61
+	/**
62
+	 * Get all Addresses filtered and sorted by sending the corresponding body payload, with
63
+	 * the option to search by the specified areas.
64
+	 *
65
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
66
+	 *
67
+	 * @param  array [$options]            - Array of options.
68
+	 *   array  [fields = []]              - An array of the fields to be included
69
+	 *                                       in the search result.
70
+	 *                                       e.g., ['address_id', 'address_alias', 'address_1'].
71
+	 *   array  [filter]                   - FIlter parameters
72
+	 *     string [query]                  - Query string.
73
+	 *     array  [selected_areas]         - Selected areas
74
+	 *       string [type]                 - Area type.
75
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
76
+	 *       array  [value]                - Area parameters.
77
+	 *         e.g.,
78
+	 *         'type' => 'circle',
79
+	 *         'value' => [
80
+	 *             'center' => ['lat' => 40, 'lng' => 80],
81
+	 *             'distance' => 1000
82
+	 *         ]
83
+	 *
84
+	 *         'type' => 'polygon',
85
+	 *         'value' => [
86
+	 *             'points' => [[74, 40], [88, 30], [90, 25]]
87
+	 *         ]
88
+	 *
89
+	 *         'type' => 'rect',
90
+	 *         'value' => [
91
+	 *             'top_left' => [50, 90],
92
+	 *             'bottom_right' => [48, 70]
93
+	 *         ]
94
+	 *
95
+	 *     array  [bounding_box]           - Coordinates of bounding box
96
+	 *       float [top]                   - Top
97
+	 *       float [left]                  - Left
98
+	 *       float [bottom                 - Bottom
99
+	 *       float [right]                 - Right
100
+	 *
101
+	 *     array  [center]                 - GPS coordinates of central point.
102
+	 *       float [lat]                   - Latitude.
103
+	 *       float [lng]                   - Longitude.
104
+	 *     float  [distance]               - Distance from the area center.
105
+	 *     string [display]                - Display option of the contacts.
106
+	 *                                       Possible values:
107
+	 *                                         'all' - all records;
108
+	 *                                         'routed' - only routed records;
109
+	 *                                         'unrouted' - only unrouted records.
110
+	 *     float  [assigned_member_id]     - A member the contact assigned to.
111
+	 *     float  [is_assigned]            - If true, the contact assigned to a member.
112
+	 *   array  [order_by]                 - Array of order fields
113
+	 *                                       You can sort the results using the specified fields:
114
+	 *                                       address_1, address_alias, first_name, last_name,
115
+	 *                                       address_phone_number, address_email, address_group,
116
+	 *                                       in_route_count, visited_count, last_visited_timestamp,
117
+	 *                                       last_routed_timestamp
118
+	 *                                       e.g., [["address_1", "asc"], ["last_name", "desc"]]
119
+	 *
120
+	 *   int    [limit]                    - Limit of the queried records number.
121
+	 *   int    [offset]                   - Offset from the beginning of the queried records.
122
+	 * @return ResponseAll
123
+	 * @throws Exception\ApiError
124
+	 */
125
+	public function getAddressesByBodyPayload(?array $options = null) : ResponseAll
126
+	{
127
+		$allBodyFields = ['fields', 'filter', 'order_by', 'limit', 'offset'];
128
+
129
+		return $this->toResponseAll(Route4Me::makeRequst([
130
+			'url' => Endpoint::ADDRESSES_INDEX_ALL,
131
+			'method' => 'POST',
132
+			'HTTPHEADER' => 'Content-Type: application/json',
133
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
134
+		]));
135
+	}
136
+
137
+	/**
138
+	 * Get a paginated list of all Addresses.
139
+	 *
140
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
141
+	 *
142
+	 * @param  array [$options]            - Array of options.
143
+	 *   string [fields]                   - Comma-delimited list of the address
144
+	 *                                       fields to be included into the search results
145
+	 *                                       e.g., 'address_id, address_alias, address_1'.
146
+	 *   string [display = 'all']          - Specify which Addresses to show in the
147
+	 *                                       corresponding query results.
148
+	 *                                       Possible values:
149
+	 *                                         'all' - all records;
150
+	 *                                         'routed' - only routed records;
151
+	 *                                         'unrouted' - only unrouted records.
152
+	 *   string [query]                    - Search in the Addresses by the
153
+	 *                                       corresponding query phrase.
154
+	 *   int    [page = 1]                 - Requested page.
155
+	 *   int    [per_page = 30]            - Number of Addresses per page.
156
+	 * @return ResponsePagination
157
+	 * @throws Exception\ApiError
158
+	 */
159
+	public function getAddressesPaginated(?array $options = null) : ResponsePagination
160
+	{
161
+		$allQueryFields = ['fields', 'display', 'query', 'page', 'per_page'];
162
+
163
+		return $this->toResponsePagination(Route4Me::makeRequst([
164
+			'url' => Endpoint::ADDRESSES_INDEX_PAGINATION,
165
+			'method' => 'GET',
166
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
167
+		]));
168
+	}
169
+
170
+	/**
171
+	 * Get the paginated list of all Addresses filtered and sorted by sending the corresponding
172
+	 * body payload, with the option to search by the specified areas.
173
+	 *
174
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
175
+	 *
176
+	 * @param  array [$options]            - Array of options.
177
+	 *   array  [fields = []]              - An array of the fields to be included
178
+	 *                                       in the search result.
179
+	 *                                       e.g., ['address_id', 'address_alias', 'address_1'].
180
+	 *   array  [filter]                   - FIlter parameters
181
+	 *     string [query]                  - Query string.
182
+	 *     array  [selected_areas]         - Selected areas
183
+	 *       string [type]                 - Area type.
184
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
185
+	 *       array  [value]                - Area parameters.
186
+	 *         e.g.,
187
+	 *         'type' => 'circle',
188
+	 *         'value' => [
189
+	 *             'center' => ['lat' => 40, 'lng' => 80],
190
+	 *             'distance' => 1000
191
+	 *         ]
192
+	 *
193
+	 *         'type' => 'polygon',
194
+	 *         'value' => [
195
+	 *             'points' => [[74, 40], [88, 30], [90, 25]]
196
+	 *         ]
197
+	 *
198
+	 *         'type' => 'rect',
199
+	 *         'value' => [
200
+	 *             'top_left' => [50, 90],
201
+	 *             'bottom_right' => [48, 70]
202
+	 *         ]
203
+	 *
204
+	 *     array  [bounding_box]           - Coordinates of bounding box
205
+	 *       float [top]                   - Top
206
+	 *       float [left]                  - Left
207
+	 *       float [bottom                 - Bottom
208
+	 *       float [right]                 - Right
209
+	 *
210
+	 *     array  [center]                 - GPS coordinates of central point.
211
+	 *       float [lat]                   - Latitude.
212
+	 *       float [lng]                   - Longitude.
213
+	 *     float  [distance]               - Distance from the area center.
214
+	 *     string [display]                - Display option of the contacts.
215
+	 *                                       Possible values:
216
+	 *                                         'all' - all records;
217
+	 *                                         'routed' - only routed records;
218
+	 *                                         'unrouted' - only unrouted records.
219
+	 *     float  [assigned_member_id]     - A member the contact assigned to.
220
+	 *     float  [is_assigned]            - If true, the contact assigned to a member.
221
+	 *   array  [order_by]                 - Array of order fields
222
+	 *                                       You can sort the results using the specified fields:
223
+	 *                                       address_1, address_alias, first_name, last_name,
224
+	 *                                       address_phone_number, address_email, address_group,
225
+	 *                                       in_route_count, visited_count, last_visited_timestamp,
226
+	 *                                       last_routed_timestamp
227
+	 *                                       e.g., [["address_1", "asc"], ["last_name", "desc"]]
228
+	 *
229
+	 *   int    [page = 1]                 - Page number.
230
+	 *   int    [per_page = 30]            - Records number per page.
231
+	 * @return ResponsePagination
232
+	 * @throws Exception\ApiError
233
+	 */
234
+	public function getAddressesPaginatedByBodyPayload(?array $options = null) : ResponsePagination
235
+	{
236
+		$allBodyFields = ['fields', 'filter', 'order_by', 'page', 'per_page'];
237
+
238
+		return $this->toResponsePagination(Route4Me::makeRequst([
239
+			'url' => Endpoint::ADDRESSES_INDEX_PAGINATION,
240
+			'method' => 'POST',
241
+			'HTTPHEADER' => 'Content-Type: application/json',
242
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
243
+		]));
244
+	}
245
+
246
+	/**
247
+	 * Get the Address clusters filtered by the corresponding query text, and with the option
248
+	 * to filter the result by the 'routed' and 'unrouted' state.
249
+	 *
250
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
251
+	 *
252
+	 * @param  array [$options]            - Array of options.
253
+	 *   string [display = 'all']          - Specify which Addresses to show in the
254
+	 *                                       corresponding query results.
255
+	 *                                       Possible values:
256
+	 *                                         'all' - all records;
257
+	 *                                         'routed' - only routed records;
258
+	 *                                         'unrouted' - only unrouted records.
259
+	 *   string [query]                    - Search in the Addresses by the
260
+	 * @return ResponseClustering
261
+	 * @throws Exception\ApiError
262
+	 */
263
+	public function getAddressClusters(?array $options = null) : ResponseClustering
264
+	{
265
+		$allQueryFields = ['display', 'query'];
266
+
267
+		return $this->toResponseClustering(Route4Me::makeRequst([
268
+			'url' => Endpoint::ADDRESSES_INDEX_CLUSTERING,
269
+			'method' => 'GET',
270
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $options)
271
+		]));
272
+	}
273
+
274
+	/**
275
+	 * Get the Address clusters by sending the corresponding body payload.
276
+	 *
277
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
278
+	 *
279
+	 * @param  array [$options]            - Array of options.
280
+	 *   array [clustering]                - Clustering
281
+	 *     int    [precision = 5]          - Clusering precision.
282
+	 *                                       Possible values from 1 to 12.
283
+	 *   array  [filter]                   - FIlter parameters
284
+	 *     string [query]                  - Query string.
285
+	 *     array  [selected_areas]         - Selected areas
286
+	 *       string [type]                 - Area type.
287
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
288
+	 *       array  [value]                - Area parameters.
289
+	 *         e.g.,
290
+	 *         'type' => 'circle',
291
+	 *         'value' => [
292
+	 *             'center' => ['lat' => 40, 'lng' => 80],
293
+	 *             'distance' => 1000
294
+	 *         ]
295
+	 *
296
+	 *         'type' => 'polygon',
297
+	 *         'value' => [
298
+	 *             'points' => [[74, 40], [88, 30], [90, 25]]
299
+	 *         ]
300
+	 *
301
+	 *         'type' => 'rect',
302
+	 *         'value' => [
303
+	 *             'top_left' => [50, 90],
304
+	 *             'bottom_right' => [48, 70]
305
+	 *         ]
306
+	 *
307
+	 *     array  [bounding_box]           - Coordinates of bounding box
308
+	 *       float [top]                   - Top
309
+	 *       float [left]                  - Left
310
+	 *       float [bottom                 - Bottom
311
+	 *       float [right]                 - Right
312
+	 *
313
+	 *     array  [center]                 - GPS coordinates of central point.
314
+	 *       float [lat]                   - Latitude.
315
+	 *       float [lng]                   - Longitude.
316
+	 *     float  [distance]               - Distance from the area center.
317
+	 *     string [display]                - Display option of the contacts.
318
+	 *                                       Possible values:
319
+	 *                                         'all' - all records;
320
+	 *                                         'routed' - only routed records;
321
+	 *                                         'unrouted' - only unrouted records.
322
+	 *     float  [assigned_member_id]     - A member the contact assigned to.
323
+	 *     float  [is_assigned]            - If true, the contact assigned to a member.
324
+	 * @return ResponseClustering
325
+	 * @throws Exception\ApiError
326
+	 */
327
+	public function getAddressClustersByBodyPayload(?array $options = null) : ResponseClustering
328
+	{
329
+		$allBodyFields = ['clustering', 'filter'];
330
+
331
+		return $this->toResponseClustering(Route4Me::makeRequst([
332
+			'url' => Endpoint::ADDRESSES_INDEX_CLUSTERING,
333
+			'method' => 'POST',
334
+			'HTTPHEADER' => 'Content-Type: application/json',
335
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $options)
336
+		]));
337
+	}
338
+
339
+	/**
340
+	 * Find an Address by sending the 'address_id' query parameter.
341
+	 *
342
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
343
+	 *
344
+	 * @param  int    $addressId           - The Address ID to be searched for.
345
+	 * @return ResponseAddress
346
+	 * @throws Exception\ApiError
347
+	 */
348
+	public function getAddressById(int $addressId) : ResponseAddress
349
+	{
350
+		return $this->toResponseAddress(Route4Me::makeRequst([
351
+			'url' => Endpoint::ADDRESSES_SHOW,
352
+			'method' => 'GET',
353
+			'query' => ['address_id' => $addressId]
354
+		]));
355
+	}
356
+
357
+	/**
358
+	 * Find multiple Addresses by sending a body payload with the array of
359
+	 * the corresponding Address IDs.
360
+	 *
361
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
362
+	 *
363
+	 * @param  array  $addressIds          - The array of Address IDs to be searched for.
364
+	 * @return ResponseAll
365
+	 * @throws Exception\ApiError
366
+	 */
367
+	public function getAddressesByIds(array $addressIds) : ResponseAll
368
+	{
369
+		return $this->toResponseAll(Route4Me::makeRequst([
370
+			'url' => Endpoint::ADDRESSES_SHOW,
371
+			'method' => 'POST',
372
+			'HTTPHEADER' => 'Content-Type: application/json',
373
+			'body' => ['address_ids' => $addressIds]
374
+		]));
375
+	}
376
+
377
+	/**
378
+	 * Add a new Address Book Contact by sending a body payload with the corresponding parameters.
379
+	 *
380
+	 * @see {@link https://route4me.io/docs/#create-a-location}
381
+	 *
382
+	 * @param  $params_or_address           - Array of address's parameters or Address object
383
+	 *   string address_1                   - The route Address Line 1.
384
+	 *   float  cached_lat                  - Cached latitude.
385
+	 *   float  cached_lng                  - Cached longitude.
386
+	 *   string address_stop_type           - The type of stop that this is one of:
387
+	 *                                        'DELIVERY', 'PICKUP', 'BREAK', 'MEETUP',
388
+	 *                                        'SERVICE', 'VISIT' or 'DRIVEBY'.
389
+	 *   int    [created_timestamp]         - When the contact created.
390
+	 *   string [address_2]                 - The route Address Line 2 which is not used for geocoding.
391
+	 *   int    [member_id]                 - Address book contact owner ID.
392
+	 *   string [address_zip]               - The zip code the address is located in.
393
+	 *   string [address_group]             - Address group.
394
+	 *   string [address_alias]             - Address alias.
395
+	 *   string [address_city]              - The city the address is located in.
396
+	 *   string [address_state_id]          - The state the address is located in.
397
+	 *   string [address_country_id]        - The country the address is located in.
398
+	 *   string [first_name]                - The first name of the receiving address.
399
+	 *   string [last_name]                 - The last name of the receiving party.
400
+	 *   string [address_email]             - Address email.
401
+	 *   string [address_phone_number]      - The phone number for the address.
402
+	 *   float  [curbside_lat]              - Curbside latitude.
403
+	 *   float  [curbside_lng]              - Curbside longitude.
404
+	 *   array  [address_custom_data]       - Array of Address custom data, as 'key' => value
405
+	 *   int    [local_time_window_start]   - Time Window Start in seconds, relative to the route start
406
+	 *                                        date (midnight), UTC time zone. It is relative to start
407
+	 *                                        date because start time changes would shift time windows.
408
+	 *   int    [local_time_window_end]     - Time Window End in seconds, relative to the route start
409
+	 *                                        date (midnight), UTC time zone. It is relative to start
410
+	 *                                        datebecause start time changes would shift time windows.
411
+	 *   int    [local_time_window_start_2] - See local_time_window_start
412
+	 *   int    [local_time_window_end_2]   - See local_time_window_end
413
+	 *   string [local_timezone_string]     - Local timezone string
414
+	 *   int    [service_time]              - Consumed service time at an address.
415
+	 *   string [color]                     - Color of an address, e.g., 'FF0000'.
416
+	 *   string [address_icon]              - URL to an address icon file.
417
+	 *   array  [schedule[]]                - Array of array of the trip schedules to a location.
418
+	 *     bool   [enabled]                 - If true, the schedule is enabled.
419
+	 *     string [mode]                    - Schedule mode.
420
+	 *     array  [monthly]                 - Monthly.
421
+	 *       int    [every]                 - Every.
422
+	 *   array  [schedule_blacklist]        - Array of the dates, which should be excluded from a trip
423
+	 *                                        schedule to a location. Also can be a date string with
424
+	 *                                        the 'YYYY-MM-DD' format or null.
425
+	 *   float  [address_cube]              - The cubic volume of the cargo being delivered or picked
426
+	 *                                        up at the address.
427
+	 *   float  [address_pieces]            - The item quantity of the cargo being delivered or picked
428
+	 *                                        up at the address.
429
+	 *   string [address_reference_no]      - The reference number for the address.
430
+	 *   float  [address_revenue]           - The total revenue for the address
431
+	 *   float  [address_weight]            - Weight of the cargo being delivered or picked up
432
+	 *                                        at the address.
433
+	 *   int    [address_priority]          - Priority of address 0 is the highest priority,
434
+	 *                                        n has higher priority than n + 1
435
+	 *   string [address_customer_po]       - The customer purchase order for the address
436
+	 *   bool   [eligible_pickup]           - If true, the address is eligible to pickup.
437
+	 *   bool   [eligible_depot]            - If true, the addrss is eligible to depot.
438
+	 *   array  [assigned_to]               - Assigned to
439
+	 *     int    [member_id]               - A member the address assigned to.
440
+	 *     string [member_first_name]       - Member first name.
441
+	 *     string [member_last_name]        - Member last name.
442
+	 *     string [member_email]            - Member email.
443
+	 *     string [until]                   - The assignment is valid until to.
444
+	 * @return ResponseAddress
445
+	 * @throws Exception\ApiError
446
+	 */
447
+	public function addAddress($params_or_address) : ResponseAddress
448
+	{
449
+		$allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
450
+			'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
451
+			'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
452
+			'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
453
+			'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
454
+			'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
455
+			'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
456
+			'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
457
+			'eligible_depot', 'assigned_to'
458
+		];
459
+
460
+		return $this->toResponseAddress(Route4Me::makeRequst([
461
+			'url' => Endpoint::ADDRESSES,
462
+			'method' => 'POST',
463
+			'HTTPHEADER' => 'Content-Type: application/json',
464
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params_or_address)
465
+		]));
466
+	}
467
+
468
+	/**
469
+	 * Add multiple new Address Book Contacts by sending a body payload with the array of
470
+	 * the corresponding Address parameters.
471
+	 *
472
+	 * @see {@link https://route4me.io/docs/#create-a-location}
473
+	 *
474
+	 * @param  array  $arr                 - Array of Address for more information look addAddress.
475
+	 * @return bool
476
+	 * @throws Exception\ApiError
477
+	 */
478
+	public function addMultipleAddresses($arr) : bool
479
+	{
480
+		$allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
481
+			'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
482
+			'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
483
+			'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
484
+			'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
485
+			'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
486
+			'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
487
+			'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
488
+			'eligible_depot', 'assigned_to'
489
+		];
490
+
491
+		$data = [];
492
+		foreach ($arr as $key => $value) {
493
+			$data[] = Route4Me::generateRequestParameters($allBodyFields, $value);
494
+		}
495
+
496
+		$result = Route4Me::makeRequst([
497
+			'url' => Endpoint::ADDRESSES_BATCH_CREATE,
498
+			'method' => 'POST',
499
+			'HTTPHEADER' => 'Content-Type: application/json',
500
+			'body' => ['data' => $data]
501
+		]);
502
+
503
+		if (is_array($result) && isset($result['status'])) {
504
+			return (bool)$result['status'];
505
+		}
506
+		return false;
507
+	}
508
+
509
+	/**
510
+	 * Update the Address Book Contact by specifying the 'address_id' path parameter
511
+	 * and by sending a body payload with the corresponding Address parameters.
512
+	 *
513
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
514
+	 *
515
+	 * @param  int    $addressId           - The Address ID to update.
516
+	 * @param  array  $params              - Parameters of address to update, for more
517
+	 *                                       information look addAddress
518
+	 * @return ResponseAddress
519
+	 * @throws Exception\ApiError
520
+	 */
521
+	public function updateAddressById(int $addressId, $params) : ResponseAddress
522
+	{
523
+		$allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
524
+			'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
525
+			'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
526
+			'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
527
+			'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
528
+			'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
529
+			'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
530
+			'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
531
+			'eligible_depot', 'assigned_to'
532
+		];
533
+
534
+		return $this->toResponseAddress(Route4Me::makeRequst([
535
+			'url' => Endpoint::ADDRESSES . '/' . $addressId,
536
+			'method' => 'PUT',
537
+			'HTTPHEADER' => 'Content-Type: application/json',
538
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
539
+		]));
540
+	}
541
+
542
+	/**
543
+	 * Update multiple Address Book Contacts by sending a body payload with the array
544
+	 * of the corresponding Address IDs and Address parameters.
545
+	 *
546
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
547
+	 *
548
+	 * @param  array $address_ids           - An array of the address IDs (int).
549
+	 * @param  $params_or_updateAddress     - Array of addresses parameters or "UpdateAddress" object
550
+	 *                                        for more information look addAddress, requires only
551
+	 *                                        one parameter service_time, all other are optional.
552
+	 * @return ResponseAddress[]
553
+	 * @throws Exception\ApiError
554
+	 */
555
+	public function updateAddressesByIds(array $address_ids, $params_or_updateAddress) : array
556
+	{
557
+		$allBodyFields = ['address_1', 'cached_lat', 'cached_lng', 'address_stop_type', 'created_timestamp',
558
+			'address_2', 'member_id', 'address_zip', 'address_group', 'address_alias', 'address_city',
559
+			'address_state_id', 'address_country_id', 'first_name', 'last_name', 'address_email',
560
+			'address_phone_number', 'curbside_lat', 'curbside_lng', 'address_custom_data',
561
+			'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2',
562
+			'local_time_window_end_2', 'local_timezone_string', 'service_time', 'color', 'address_icon',
563
+			'schedule', 'schedule_blacklist', 'address_cube', 'address_pieces', 'address_reference_no',
564
+			'address_revenue', 'address_weight', 'address_priority', 'address_customer_po', 'eligible_pickup',
565
+			'eligible_depot'
566
+		];
567
+
568
+		$params = Route4Me::generateRequestParameters($allBodyFields, $params_or_updateAddress);
569
+		$params['address_ids'] = $address_ids;
570
+
571
+		$result = Route4Me::makeRequst([
572
+			'url' => Endpoint::ADDRESSES_BATCH_UPDATE,
573
+			'method' => 'PUT',
574
+			'HTTPHEADER' => 'Content-Type: application/json',
575
+			'body' => $params
576
+		]);
577
+
578
+		if (is_array($result)) {
579
+			$data = [];
580
+			foreach ($result as $key => $value) {
581
+				$data[] = $this->toResponseAddress($value);
582
+			}
583
+			return $data;
584
+		}
585
+		return [];
586
+	}
587
+
588
+	/**
589
+	 * Update Address Book Contacts by sending a body payload with the corresponding query
590
+	 * text and specified territory areas.
591
+	 *
592
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
593
+	 *
594
+	 * @todo request has uncheckable result - 403 forbidden
595
+	 *
596
+	 * @param  array  $filter              - FIlter parameters
597
+	 *   string [query]                    - Search in the Addresses by the query phrase.
598
+	 *   array  [bounding_box]             - Coordinates of bounding box
599
+	 *     float [top]                     - Top
600
+	 *     float [left]                    - Left
601
+	 *     float [bottom                   - Bottom
602
+	 *     float [right]                   - Right
603
+	 *   array  [selected_areas]           - Selected areas
604
+	 *     string [type]                   - Area type.
605
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
606
+	 *     array  [value]                  - Area parameters.
607
+	 *       e.g.,
608
+	 *       'type' => 'circle',
609
+	 *       'value' => [
610
+	 *           'center' => ['lat' => 40, 'lng' => 80],
611
+	 *           'distance' => 1000
612
+	 *       ]
613
+	 *
614
+	 *       'type' => 'polygon',
615
+	 *       'value' => [
616
+	 *           'points' => [[74, 40], [88, 30], [90, 25]]
617
+	 *       ]
618
+	 *
619
+	 *       'type' => 'rect',
620
+	 *       'value' => [
621
+	 *           'top_left' => [50, 90],
622
+	 *           'bottom_right' => [48, 70]
623
+	 *       ]
624
+	 * @param  array  $params               - Parameters of address to update, for more
625
+	 *                                        information look addAddresses
626
+	 *   string [address_group]             - Address group.
627
+	 *   string [address_alias]             - Address alias.
628
+	 *   int    [member_id]                 - Address book contact owner ID.
629
+	 *   string [first_name]                - The first name of the receiving address.
630
+	 *   string [last_name]                 - The last name of the receiving party.
631
+	 *   string [address_email]             - Address email.
632
+	 *   string [address_phone_number]      - The phone number for the address.
633
+	 *   array  [address_custom_data]       - Array of Address custom data, as 'key' => value
634
+	 *   int    [local_time_window_start]   - Time Window Start in seconds, relative to the route start
635
+	 *                                        date (midnight), UTC time zone. It is relative to start
636
+	 *                                        date because start time changes would shift time windows.
637
+	 *   int    [local_time_window_end]     - Time Window End in seconds, relative to the route start
638
+	 *                                        date (midnight), UTC time zone. It is relative to start
639
+	 *                                        datebecause start time changes would shift time windows.
640
+	 *   int    [local_time_window_start_2] - See local_time_window_start
641
+	 *   int    [local_time_window_end_2]   - See local_time_window_end
642
+	 *   string [local_timezone_string]     - Local timezone string
643
+	 *   int    [service_time]              - Consumed service time at an address.
644
+	 *   string [color]                     - Color of an address, e.g., 'FF0000'.
645
+	 *   string [address_icon]              - URL to an address icon file.
646
+	 *   bool   [eligible_pickup]           - If true, the address is eligible to pickup.
647
+	 *   bool   [eligible_depot]            - If true, the addrss is eligible to depot.
648
+	 * @return StatusChecker
649
+	 * @throws Exception\ApiError
650
+	 */
651
+	public function updateAddressesByAreas(array $filter, array $params) : StatusChecker
652
+	{
653
+		$allFilterFields = ['query', 'bounding_box', 'selected_areas'];
654
+
655
+		$allParamsFields = ['member_id', 'address_group', 'address_alias', 'first_name', 'last_name',
656
+			'address_email', 'address_phone_number', 'address_custom_data', 'local_time_window_start',
657
+			'local_time_window_end', 'local_time_window_start_2', 'local_time_window_end_2',
658
+			'local_timezone_string', 'service_time', 'color', 'address_icon', 'eligible_pickup',
659
+			'eligible_depot'
660
+		];
661
+
662
+		return new StatusChecker(Route4Me::makeRequst([
663
+			'url' => Endpoint::ADDRESSES_UPDATE_BY_AREAS,
664
+			'method' => 'PUT',
665
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
666
+			'return_headers' => ['location'],
667
+			'body' => [
668
+				'filter' => Route4Me::generateRequestParameters($allFilterFields, $filter),
669
+				'data' => Route4Me::generateRequestParameters($allParamsFields, $params)
670
+			]
671
+		]));
672
+	}
673
+
674
+	/**
675
+	 * Delete multiple Address Book Contacts by sending a body payload with the
676
+	 * array of the corresponding Address IDs.
677
+	 *
678
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
679
+	 *
680
+	 * @param  array  addressIds           - The array of Address IDs to delete.
681
+	 * @return StatusChecker
682
+	 * @throws Exception\ApiError
683
+	 */
684
+	public function deleteAddressesByIds(array $addressIds) : StatusChecker
685
+	{
686
+		return new StatusChecker(Route4Me::makeRequst([
687
+			'url' => Endpoint::ADDRESSES_DELETE,
688
+			'method' => 'DELETE',
689
+			'HTTPHEADER' => 'Content-Type: application/json',
690
+			'return_headers' => ['location', 'x-job-id'],
691
+			'body' => ['address_ids' => $addressIds]
692
+		]));
693
+	}
694
+
695
+	/**
696
+	 * Delete the Address Book Contacts located in the selected areas by sending
697
+	 * the corresponding body payload.
698
+	 *
699
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
700
+	 *
701
+	 * @todo request has uncheckable result - 403 forbidden
702
+	 *
703
+	 * @param  array  $filter              - FIlter parameters
704
+	 *   string [query]                    - Search in the Addresses by the query phrase.
705
+	 *   array  [bounding_box]             - Coordinates of bounding box
706
+	 *     float [top]                     - Top
707
+	 *     float [left]                    - Left
708
+	 *     float [bottom                   - Bottom
709
+	 *     float [right]                   - Right
710
+	 *   array  [selected_areas]           - Selected areas
711
+	 *     string [type]                   - Area type.
712
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
713
+	 *     array  [value]                  - Area parameters.
714
+	 *       e.g.,
715
+	 *       'type' => 'circle',
716
+	 *       'value' => [
717
+	 *           'center' => ['lat' => 40, 'lng' => 80],
718
+	 *           'distance' => 1000
719
+	 *       ]
720
+	 *
721
+	 *       'type' => 'polygon',
722
+	 *       'value' => [
723
+	 *           'points' => [[74, 40], [88, 30], [90, 25]]
724
+	 *       ]
725
+	 *
726
+	 *       'type' => 'rect',
727
+	 *       'value' => [
728
+	 *           'top_left' => [50, 90],
729
+	 *           'bottom_right' => [48, 70]
730
+	 *       ]
731
+	 * @return StatusChecker
732
+	 * @throws Exception\ApiError
733
+	 */
734
+	public function deleteAddressesByAreas($filter) : StatusChecker
735
+	{
736
+		$allFilterFields = ['query', 'bounding_box', 'selected_areas'];
737
+
738
+		return new StatusChecker(Route4Me::makeRequst([
739
+			'url' => Endpoint::ADDRESSES_DELETE_BY_AREAS,
740
+			'method' => 'DELETE',
741
+			'return_headers' => ['location', 'x-job-id'],
742
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
743
+			'body' => ['filter' => Route4Me::generateRequestParameters($allFilterFields, $filter)]
744
+		]));
745
+	}
746
+
747
+	/**
748
+	 * Get all Address custom fields.
749
+	 *
750
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
751
+	 *
752
+	 * @return array
753
+	 * @throws Exception\ApiError
754
+	 */
755
+	public function getAddressCustomFields() : array
756
+	{
757
+		return Route4Me::makeRequst([
758
+			'url' => Endpoint::ADDRESSES_CUSTOM_FIELDS,
759
+			'method' => 'GET'
760
+		]);
761
+	}
762
+
763
+	/**
764
+	 * Get depots Addresses.
765
+	 *
766
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
767
+	 *
768
+	 * @return array
769
+	 * @throws Exception\ApiError
770
+	 */
771
+	public function getAddressesDepots() : array
772
+	{
773
+		return Route4Me::makeRequst([
774
+			'url' => Endpoint::ADDRESSES_DEPOTS,
775
+			'method' => 'GET'
776
+		]);
777
+	}
778
+
779
+	/**
780
+	 * Export Address Book Contacts to the specified file by sending a body
781
+	 * payload with the array of the corresponding Address IDs.
782
+	 *
783
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
784
+	 *
785
+	 * @param  array  addressIds           - Array of addresses ID to export.
786
+	 * @param  string filename             - The name of the file to export.
787
+	 * @return StatusChecker
788
+	 * @throws Exception\ApiError
789
+	 */
790
+	public function exportAddressesByIds(array $addressIds, string $filename) : StatusChecker
791
+	{
792
+		return new StatusChecker(Route4Me::makeRequst([
793
+			'url' => Endpoint::ADDRESSES_EXPORT,
794
+			'method' => 'POST',
795
+			'HTTPHEADER' => 'Content-Type: application/json',
796
+			'return_headers' => ['location'],
797
+			'body' => ['ids' => $addressIds, 'filename' => $filename]
798
+		]));
799
+	}
800
+
801
+	/**
802
+	 * Export the Address Book Contacts located in the selected areas
803
+	 * by sending the corresponding body payload.
804
+	 *
805
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
806
+	 *
807
+	 * @todo request has uncheckable result - 403 forbidden
808
+	 *
809
+	 * @param  array  $filter              - FIlter parameters
810
+	 *   string [query]                    - Search in the Addresses by the query phrase.
811
+	 *   array  [bounding_box]             - Coordinates of bounding box
812
+	 *     float [top]                     - Top
813
+	 *     float [left]                    - Left
814
+	 *     float [bottom                   - Bottom
815
+	 *     float [right]                   - Right
816
+	 *   array  [selected_areas]           - Selected areas
817
+	 *     string [type]                   - Area type.
818
+	 *                                       Possible values: 'circle', 'polygon', 'rect'.
819
+	 *     array  [value]                  - Area parameters.
820
+	 *       e.g.,
821
+	 *       'type' => 'circle',
822
+	 *       'value' => [
823
+	 *           'center' => ['lat' => 40, 'lng' => 80],
824
+	 *           'distance' => 1000
825
+	 *       ]
826
+	 *
827
+	 *       'type' => 'polygon',
828
+	 *       'value' => [
829
+	 *           'points' => [[74, 40], [88, 30], [90, 25]]
830
+	 *       ]
831
+	 *
832
+	 *       'type' => 'rect',
833
+	 *       'value' => [
834
+	 *           'top_left' => [50, 90],
835
+	 *           'bottom_right' => [48, 70]
836
+	 *        ]
837
+	 *   string filename                   - The name of the file to export.
838
+	 * @return StatusChecker
839
+	 * @throws Exception\ApiError
840
+	 */
841
+	public function exportAddressesByAreas(array $filter) : StatusChecker
842
+	{
843
+		$allFilterFields = ['query', 'bounding_box', 'selected_areas', 'filename'];
844
+
845
+		return new StatusChecker(Route4Me::makeRequst([
846
+			'url' => Endpoint::ADDRESSES_EXPORT_BY_AREAS,
847
+			'method' => 'POST',
848
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
849
+			'return_headers' => ['location'],
850
+			'body' => ['filter' => Route4Me::generateRequestParameters($allFilterFields, $filter)]
851
+		]));
852
+	}
853
+
854
+	/**
855
+	 * Export Addresses by the specified area IDs.
856
+	 *
857
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
858
+	 *
859
+	 * @todo request has uncheckable result - 403 forbidden
860
+	 *
861
+	 * @param  array  territoryIds         - An array of the territory IDs.
862
+	 * @param  string filename             - The name of the file to export.
863
+	 * @return StatusChecker
864
+	 * @throws Exception\ApiError
865
+	 */
866
+	public function exportAddressesByAreaIds(array $territoryIds, string $filename) : StatusChecker
867
+	{
868
+		return new StatusChecker(Route4Me::makeRequst([
869
+			'url' => Endpoint::ADDRESSES_EXPORT_BY_AREA_IDS,
870
+			'method' => 'POST',
871
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json'],
872
+			'return_headers' => ['location'],
873
+			'body' => ['territory_ids' => $territoryIds, 'filename' => $filename]
874
+		]));
875
+	}
876
+
877
+	/**
878
+	 * Check the asynchronous job status by specifying the 'job_id' path parameter.
879
+	 *
880
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
881
+	 *
882
+	 * @param  int    filename             - Job ID to check status.
883
+	 * @return StatusChecker
884
+	 * @throws Exception\ApiError
885
+	 */
886
+	public function getAddressesAsynchronousJobStatus(string $jobId) : StatusChecker
887
+	{
888
+		return new StatusChecker(Route4Me::makeRequst([
889
+			'url' => Endpoint::ADDRESSES_JOB_TRACKER_STATUS . '/' . $jobId,
890
+			'method' => 'GET',
891
+			'HTTPHEADER' => 'Accept: application/json',
892
+			'return_headers' => ['X-R4M-Async-Job-Running-Time']
893
+		]));
894
+	}
895
+
896
+	/**
897
+	 * Get the asynchronous job result by specifying the 'job_id' path parameter.
898
+	 *
899
+	 * @see {@link https://virtserver.swaggerhub.com/Route4Me/address-book/1.0.0}
900
+	 *
901
+	 * @param  int    filename             - Job ID get result.
902
+	 * @return bool
903
+	 * @throws Exception\ApiError
904
+	 */
905
+	public function getAddressesAsynchronousJobResult(string $jobId) : bool
906
+	{
907
+		$result = Route4Me::makeRequst([
908
+			'url' => Endpoint::ADDRESSES_JOB_TRACKER_RESULT . '/' . $jobId,
909
+			'method' => 'GET'
910
+		]);
911
+		return (is_array($result) && isset($result['status']) && $result['status'] ? $result['status'] : false);
912
+	}
913
+
914
+	private function toResponseAddress($result) : ResponseAddress
915
+	{
916
+		if (is_array($result)) {
917
+			return new ResponseAddress($result);
918
+		}
919
+		throw new ApiError('Can not convert result to ResponseAddress object.');
920
+	}
921
+
922
+	private function toResponseAll($result) : ResponseAll
923
+	{
924
+		if (is_array($result)) {
925
+			return new ResponseAll($result);
926
+		}
927
+		throw new ApiError('Can not convert result to ResponseAll object.');
928
+	}
929
+
930
+	private function toResponsePagination($result) : ResponsePagination
931
+	{
932
+		if (is_array($result)) {
933
+			return new ResponsePagination($result);
934
+		}
935
+		throw new ApiError('Can not convert result to ResponsePagination object.');
936
+	}
937
+
938
+	private function toResponseClustering($result) : ResponseClustering
939
+	{
940
+		if (is_array($result)) {
941
+			return new ResponseClustering($result);
942
+		}
943
+		throw new ApiError('Can not convert result to ResponseClustering object.');
944
+	}
945 945
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         ];
533 533
 
534 534
         return $this->toResponseAddress(Route4Me::makeRequst([
535
-            'url' => Endpoint::ADDRESSES . '/' . $addressId,
535
+            'url' => Endpoint::ADDRESSES.'/'.$addressId,
536 536
             'method' => 'PUT',
537 537
             'HTTPHEADER' => 'Content-Type: application/json',
538 538
             'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
     public function getAddressesAsynchronousJobStatus(string $jobId) : StatusChecker
887 887
     {
888 888
         return new StatusChecker(Route4Me::makeRequst([
889
-            'url' => Endpoint::ADDRESSES_JOB_TRACKER_STATUS . '/' . $jobId,
889
+            'url' => Endpoint::ADDRESSES_JOB_TRACKER_STATUS.'/'.$jobId,
890 890
             'method' => 'GET',
891 891
             'HTTPHEADER' => 'Accept: application/json',
892 892
             'return_headers' => ['X-R4M-Async-Job-Running-Time']
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
     public function getAddressesAsynchronousJobResult(string $jobId) : bool
906 906
     {
907 907
         $result = Route4Me::makeRequst([
908
-            'url' => Endpoint::ADDRESSES_JOB_TRACKER_RESULT . '/' . $jobId,
908
+            'url' => Endpoint::ADDRESSES_JOB_TRACKER_RESULT.'/'.$jobId,
909 909
             'method' => 'GET'
910 910
         ]);
911 911
         return (is_array($result) && isset($result['status']) && $result['status'] ? $result['status'] : false);
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/BundledItemResponse.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,53 +12,53 @@
 block discarded – undo
12 12
  */
13 13
 class BundledItemResponse extends \Route4Me\Common
14 14
 {
15
-    /** Summary cube value of the bundled addresses
16
-     * @var double $cube
17
-     */
18
-    public $cube;
15
+	/** Summary cube value of the bundled addresses
16
+	 * @var double $cube
17
+	 */
18
+	public $cube;
19 19
 
20
-    /** Summary revenue value of the bundled addresses
21
-     * @var double $revenue
22
-     */
23
-    public $revenue;
20
+	/** Summary revenue value of the bundled addresses
21
+	 * @var double $revenue
22
+	 */
23
+	public $revenue;
24 24
 
25
-    /** Summary pieces value of the bundled addresses
26
-     * @var integer $pieces
27
-     */
28
-    public $pieces;
25
+	/** Summary pieces value of the bundled addresses
26
+	 * @var integer $pieces
27
+	 */
28
+	public $pieces;
29 29
 
30
-    /** Summary weight value of the bundled addresses
31
-     * @var double $weight
32
-     */
33
-    public $weight;
30
+	/** Summary weight value of the bundled addresses
31
+	 * @var double $weight
32
+	 */
33
+	public $weight;
34 34
 
35
-    /** Summary cost value of the bundled addresses
36
-     * @var double $cost
37
-     */
38
-    public $cost;
35
+	/** Summary cost value of the bundled addresses
36
+	 * @var double $cost
37
+	 */
38
+	public $cost;
39 39
 
40
-    /** Service time of the bundled addresses
41
-     * @var integer $service_time
42
-     */
43
-    public $service_time;
40
+	/** Service time of the bundled addresses
41
+	 * @var integer $service_time
42
+	 */
43
+	public $service_time;
44 44
 
45
-    /** Time window start of the bundled addresses
46
-     * @var integer $time_window_start
47
-     */
48
-    public $time_window_start;
45
+	/** Time window start of the bundled addresses
46
+	 * @var integer $time_window_start
47
+	 */
48
+	public $time_window_start;
49 49
 
50
-    /** Time window emd of the bundled addresses
51
-     * @var integer $time_window_end
52
-     */
53
-    public $time_window_end;
50
+	/** Time window emd of the bundled addresses
51
+	 * @var integer $time_window_end
52
+	 */
53
+	public $time_window_end;
54 54
 
55
-    /** TO DO: Adjust description
56
-     * @var array $custom_data
57
-     */
58
-    public $custom_data = [];
55
+	/** TO DO: Adjust description
56
+	 * @var array $custom_data
57
+	 */
58
+	public $custom_data = [];
59 59
 
60
-    /** Array of the IDs of the bundeld addresses.
61
-     * @var integer[] $addresses_id
62
-     */
63
-    public $addresses_id = [];
60
+	/** Array of the IDs of the bundeld addresses.
61
+	 * @var integer[] $addresses_id
62
+	 */
63
+	public $addresses_id = [];
64 64
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/RouteAdvancedConstraints.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -11,60 +11,60 @@
 block discarded – undo
11 11
  */
12 12
 class RouteAdvancedConstraints extends Common
13 13
 {
14
-    /**
15
-     * Maximum cargo volume per route.
16
-     * @var double
17
-     */
18
-    public $max_cargo_volume;
14
+	/**
15
+	 * Maximum cargo volume per route.
16
+	 * @var double
17
+	 */
18
+	public $max_cargo_volume;
19 19
 
20
-    /**
21
-     * Vehicle capacity.<br>
22
-     * How much total cargo can be transported per route (units, e.g. cubic meters)
23
-     * @var integer
24
-     */
25
-    public $max_capacity;
20
+	/**
21
+	 * Vehicle capacity.<br>
22
+	 * How much total cargo can be transported per route (units, e.g. cubic meters)
23
+	 * @var integer
24
+	 */
25
+	public $max_capacity;
26 26
 
27
-    /**
28
-     * Legacy feature which permits a user to request an example number of optimized routes.
29
-     * @var integer
30
-     */
31
-    public $members_count;
27
+	/**
28
+	 * Legacy feature which permits a user to request an example number of optimized routes.
29
+	 * @var integer
30
+	 */
31
+	public $members_count;
32 32
 
33
-    /**
34
-     * An array of the available time windows (e.g. [ [25200, 75000 ] )
35
-     * @var integer[]
36
-     */
37
-    public $available_time_windows;
33
+	/**
34
+	 * An array of the available time windows (e.g. [ [25200, 75000 ] )
35
+	 * @var integer[]
36
+	 */
37
+	public $available_time_windows;
38 38
 
39
-    /**
40
-     * The driver tags specified in a team member's custom data.<br>
41
-     * e.g. "driver skills":<br>
42
-     * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"]
43
-     * @var string[]
44
-     */
45
-    public $tags;
39
+	/**
40
+	 * The driver tags specified in a team member's custom data.<br>
41
+	 * e.g. "driver skills":<br>
42
+	 * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"]
43
+	 * @var string[]
44
+	 */
45
+	public $tags;
46 46
 
47
-    /**
48
-     * An array of the skilled driver IDs.
49
-     * @var integer[]
50
-     */
51
-    public $route4me_members_id;
47
+	/**
48
+	 * An array of the skilled driver IDs.
49
+	 * @var integer[]
50
+	 */
51
+	public $route4me_members_id;
52 52
 
53
-    /**
54
-     * An array containing Address objects.
55
-     * @var Address
56
-     */
57
-    public $depot_address;
53
+	/**
54
+	 * An array containing Address objects.
55
+	 * @var Address
56
+	 */
57
+	public $depot_address;
58 58
 
59
-    /**
60
-     * An array of locations.
61
-     * @var object[]
62
-     */
63
-    public $location_sequence_pattern;
59
+	/**
60
+	 * An array of locations.
61
+	 * @var object[]
62
+	 */
63
+	public $location_sequence_pattern;
64 64
 
65
-    /**
66
-     * Group.
67
-     * @var string
68
-     */
69
-    public $group;
65
+	/**
66
+	 * Group.
67
+	 * @var string
68
+	 */
69
+	public $group;
70 70
 }
Please login to merge, or discard this patch.