@@ -9,33 +9,33 @@ |
||
| 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 | } |
@@ -9,21 +9,21 @@ |
||
| 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 | } |
@@ -20,926 +20,926 @@ |
||
| 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 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -12,53 +12,53 @@ |
||
| 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 | } |
@@ -11,60 +11,60 @@ |
||
| 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 | } |
@@ -14,653 +14,653 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Address extends \Route4Me\Common |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Route destination ID |
|
| 19 | - * @var integer |
|
| 20 | - */ |
|
| 21 | - public $route_destination_id; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Route alias |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - public $alias; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * The ID of the member inside the Route4Me system. |
|
| 31 | - * @var integer |
|
| 32 | - */ |
|
| 33 | - public $member_id; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Route destination address |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 39 | - public $address; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Designate this stop as a depot. |
|
| 43 | - * A route may have multiple depots/points of origin. |
|
| 44 | - * @var boolean |
|
| 45 | - */ |
|
| 46 | - public $is_depot; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Timeframe violation state |
|
| 50 | - * @var integer |
|
| 51 | - */ |
|
| 52 | - public $timeframe_violation_state; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Timeframe violation time |
|
| 56 | - * @var integer |
|
| 57 | - */ |
|
| 58 | - public $timeframe_violation_time; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Timeframe violation rate |
|
| 62 | - * @var double |
|
| 63 | - */ |
|
| 64 | - public $timeframe_violation_rate; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * The latitude of this address |
|
| 68 | - * @var double |
|
| 69 | - */ |
|
| 70 | - public $lat; |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * The longitude of this address |
|
| 74 | - * @var double |
|
| 75 | - */ |
|
| 76 | - public $lng; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Curbside latitude. |
|
| 80 | - * Generate optimal routes and driving directions to this curbside latitude. |
|
| 81 | - * @var double |
|
| 82 | - */ |
|
| 83 | - public $curbside_lat; |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Curbside longitude. |
|
| 87 | - * Generate optimal routes and driving directions to the curbside longitude. |
|
| 88 | - * @var double |
|
| 89 | - */ |
|
| 90 | - public $curbside_lng; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * If present, the priority will sequence addresses in all the optimal routes so that |
|
| 94 | - * higher priority addresses are general at the beginning of the route sequence. |
|
| 95 | - * 1 is the highest priority, 100000 is the lowest. |
|
| 96 | - * @var integer |
|
| 97 | - */ |
|
| 98 | - public $priority; |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * The ID of the route being viewed, modified, or erased. |
|
| 102 | - * @var string |
|
| 103 | - */ |
|
| 104 | - public $route_id; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * If this route was duplicated from an existing route, |
|
| 108 | - * this value would have the original route's ID. |
|
| 109 | - * @var string |
|
| 110 | - */ |
|
| 111 | - public $original_route_id; |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Route name of a depot address. |
|
| 115 | - * @var string |
|
| 116 | - */ |
|
| 117 | - public $route_name; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The ID of the optimization request that was used to initially instantiate this route. |
|
| 121 | - * @var string |
|
| 122 | - */ |
|
| 123 | - public $optimization_problem_id; |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * The destination's sequence number in the route. |
|
| 127 | - * @var integer |
|
| 128 | - */ |
|
| 129 | - public $sequence_no; |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * True if the address is geocoded. |
|
| 133 | - * @var boolean |
|
| 134 | - */ |
|
| 135 | - public $geocoded; |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * The preferred geocoding number. |
|
| 139 | - * @var integer |
|
| 140 | - */ |
|
| 141 | - public $preferred_geocoding; |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * True if geocoding failed. |
|
| 145 | - * @var boolean |
|
| 146 | - */ |
|
| 147 | - public $failed_geocoding; |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * An array containing Geocoding objects. |
|
| 151 | - * @var Geocoding[] |
|
| 152 | - */ |
|
| 153 | - public $geocodings = []; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * When planning a route from the address book or using existing address book IDs, |
|
| 157 | - * pass the address book ID (contact_id) for an address so that Route4Me can run |
|
| 158 | - * analytics on the address book addresses that were used to plan routes, and to find previous visits to |
|
| 159 | - * favorite addresses. |
|
| 160 | - * @var integer |
|
| 161 | - */ |
|
| 162 | - public $contact_id; |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * The address order ID |
|
| 166 | - * @var integer |
|
| 167 | - */ |
|
| 168 | - public $order_id; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Route address stop type |
|
| 172 | - * @var string |
|
| 173 | - */ |
|
| 174 | - public $address_stop_type; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * The status flag to mark an address as visited (aka check in). |
|
| 178 | - * @var boolean |
|
| 179 | - */ |
|
| 180 | - public $is_visited; |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * The last known visited timestamp of this address. |
|
| 184 | - * @var integer |
|
| 185 | - */ |
|
| 186 | - public $timestamp_last_visited; |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Latitude of the visited address |
|
| 190 | - * @var double |
|
| 191 | - */ |
|
| 192 | - public $visited_lat; |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Longitude of the visited address |
|
| 196 | - * @var double |
|
| 197 | - */ |
|
| 198 | - public $visited_lng; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * The status flag to mark an address as departed (aka check out). |
|
| 202 | - * @var boolean |
|
| 203 | - */ |
|
| 204 | - public $is_departed; |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Departed address latitude |
|
| 208 | - * @var double |
|
| 209 | - */ |
|
| 210 | - public $departed_lat; |
|
| 211 | - |
|
| 212 | - /** Departed address longitude |
|
| 213 | - * @var double |
|
| 214 | - */ |
|
| 215 | - public $departed_lng; |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * he last known departed timestamp of this address. |
|
| 219 | - * @var integer |
|
| 220 | - */ |
|
| 221 | - public $timestamp_last_departed; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * The address group |
|
| 225 | - * @var string |
|
| 226 | - */ |
|
| 227 | - public $group; |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * Pass-through data about this route destination.<br> |
|
| 231 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 232 | - * @var string |
|
| 233 | - */ |
|
| 234 | - public $customer_po; |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Pass-through data about this route destination.<br> |
|
| 238 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 239 | - * @var string |
|
| 240 | - */ |
|
| 241 | - public $invoice_no; |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Pass-through data about this route destination.<br> |
|
| 245 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 246 | - * @var string |
|
| 247 | - */ |
|
| 248 | - public $reference_no; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * Pass-through data about this route destination.<br> |
|
| 252 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 253 | - * @var string |
|
| 254 | - */ |
|
| 255 | - public $order_no; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * The address cargo weight |
|
| 259 | - * @var double |
|
| 260 | - */ |
|
| 261 | - public $weight; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * The address cost |
|
| 265 | - * @var double |
|
| 266 | - */ |
|
| 267 | - public $cost; |
|
| 268 | - |
|
| 269 | - /** |
|
| 270 | - * The address revenue |
|
| 271 | - * @var double |
|
| 272 | - */ |
|
| 273 | - public $revenue; |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * The cubic volume that this destination/order/line-item consumes/contains.<br> |
|
| 277 | - * This is how much space it will take up on a vehicle. |
|
| 278 | - * @var double |
|
| 279 | - */ |
|
| 280 | - public $cube; |
|
| 281 | - |
|
| 282 | - /** |
|
| 283 | - * The number of pieces/palllets that this destination/order/line-item consumes/contains on a vehicle. |
|
| 284 | - * @var integer |
|
| 285 | - */ |
|
| 286 | - public $pieces; |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * First name |
|
| 290 | - * @var string |
|
| 291 | - */ |
|
| 292 | - public $first_name; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * Last name |
|
| 296 | - * @var string |
|
| 297 | - */ |
|
| 298 | - public $last_name; |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * Pass-through data about this route destination. |
|
| 302 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 303 | - * Also used to email clients when vehicles are approaching (future capability). |
|
| 304 | - * @var string |
|
| 305 | - */ |
|
| 306 | - public $email; |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Pass-through data about this route destination. |
|
| 310 | - * The data will be visible on the manifest, website, and mobile apps. |
|
| 311 | - * Also used to send SMS messages to clients when vehicles are approaching (future capability). |
|
| 312 | - * @var string |
|
| 313 | - */ |
|
| 314 | - public $phone; |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * The number of notes that are already associated with this address on the route. |
|
| 318 | - * @var integer |
|
| 319 | - */ |
|
| 320 | - public $destination_note_count; |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * Server-side generated amount of km/miles that |
|
| 324 | - * it will take to get to the next location on the route. |
|
| 325 | - * @var integer |
|
| 326 | - */ |
|
| 327 | - public $drive_time_to_next_destination; |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * Abnormal traffic time to next destination. |
|
| 331 | - * @var integer |
|
| 332 | - */ |
|
| 333 | - public $abnormal_traffic_time_to_next_destination; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * Uncongested time to next destination. |
|
| 337 | - * @var integer |
|
| 338 | - */ |
|
| 339 | - public $uncongested_time_to_next_destination; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Traffic time to next destination. |
|
| 343 | - * @var integer |
|
| 344 | - */ |
|
| 345 | - public $traffic_time_to_next_destination; |
|
| 346 | - |
|
| 347 | - /** |
|
| 348 | - * Server-side generated amount of seconds |
|
| 349 | - * that it will take to get to the next location. |
|
| 350 | - * @var double |
|
| 351 | - */ |
|
| 352 | - public $distance_to_next_destination; |
|
| 353 | - |
|
| 354 | - /** |
|
| 355 | - * The unique socket channel name which |
|
| 356 | - * should be used to get real time alerts. |
|
| 357 | - * @var string |
|
| 358 | - */ |
|
| 359 | - public $channel_name; |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * Alias of a pickup point. |
|
| 363 | - * @var string |
|
| 364 | - */ |
|
| 365 | - public $pickup; |
|
| 366 | - |
|
| 367 | - /** |
|
| 368 | - * Alias of the paired pickup point. |
|
| 369 | - * @var string |
|
| 370 | - */ |
|
| 371 | - public $dropoff; |
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * If equal to 1, the pickup and dropoff addresses are joint |
|
| 375 | - * (one by one despite the regular pickup-dropoff addresses |
|
| 376 | - * when it's possible to have multiple pickup addresses with one dropoff address). |
|
| 377 | - * @var integer |
|
| 378 | - */ |
|
| 379 | - public $joint; |
|
| 380 | - |
|
| 381 | - /** |
|
| 382 | - * Generated time window start. |
|
| 383 | - * @var integer |
|
| 384 | - */ |
|
| 385 | - public $generated_time_window_start; |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Estimated time window end based on the optimization engine, |
|
| 389 | - * after all the sequencing has been completed. |
|
| 390 | - * @var integer |
|
| 391 | - */ |
|
| 392 | - public $generated_time_window_end; |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * The address time window start. |
|
| 396 | - * @var integer |
|
| 397 | - */ |
|
| 398 | - public $time_window_start; |
|
| 399 | - |
|
| 400 | - /** |
|
| 401 | - * The address time window end. |
|
| 402 | - * @var integer |
|
| 403 | - */ |
|
| 404 | - public $time_window_end; |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * The address time window start 2. |
|
| 408 | - * @var integer |
|
| 409 | - */ |
|
| 410 | - public $time_window_start_2; |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * The address time window end 2. |
|
| 414 | - * @var integer |
|
| 415 | - */ |
|
| 416 | - public $time_window_end_2; |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Geofence detected visited timestamp |
|
| 420 | - * @var integer |
|
| 421 | - */ |
|
| 422 | - public $geofence_detected_visited_timestamp; |
|
| 423 | - |
|
| 424 | - /** |
|
| 425 | - * Geofence detected departed timestamp |
|
| 426 | - * @var integer |
|
| 427 | - */ |
|
| 428 | - public $geofence_detected_departed_timestamp; |
|
| 429 | - |
|
| 430 | - /** |
|
| 431 | - * Geofence detected service time |
|
| 432 | - * @var integer |
|
| 433 | - */ |
|
| 434 | - public $geofence_detected_service_time; |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Geofence detected visited latitude |
|
| 438 | - * @var double |
|
| 439 | - */ |
|
| 440 | - public $geofence_detected_visited_lat; |
|
| 441 | - |
|
| 442 | - /** |
|
| 443 | - * Geofence detected visited longitude |
|
| 444 | - * @var double |
|
| 445 | - */ |
|
| 446 | - public $geofence_detected_visited_lng; |
|
| 447 | - |
|
| 448 | - /** |
|
| 449 | - * Geofence detected departed latitude |
|
| 450 | - * @var double |
|
| 451 | - */ |
|
| 452 | - public $geofence_detected_departed_lat; |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * Geofence detected departed longitude |
|
| 456 | - * @var double |
|
| 457 | - */ |
|
| 458 | - public $geofence_detected_departed_lng; |
|
| 459 | - |
|
| 460 | - /** |
|
| 461 | - * The expected amount of time that will be spent |
|
| 462 | - * at this address by the driver/user. |
|
| 463 | - * @var integer |
|
| 464 | - */ |
|
| 465 | - public $time; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * System-wide unique code, which permits end-users (recipients) |
|
| 469 | - * to track the status of their order. |
|
| 470 | - * @var string |
|
| 471 | - */ |
|
| 472 | - public $tracking_number; |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * The address custom fields. |
|
| 476 | - * @var array |
|
| 477 | - */ |
|
| 478 | - public $custom_fields = []; |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * The custom fields configuration in JSON format. |
|
| 482 | - * @var string |
|
| 483 | - */ |
|
| 484 | - public $custom_fields_str_json; |
|
| 485 | - |
|
| 486 | - /** |
|
| 487 | - * The custom fields configuration. |
|
| 488 | - * @var string[] |
|
| 489 | - */ |
|
| 490 | - public $custom_fields_config = []; |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * The custom fields configuration in JSON format. |
|
| 494 | - * @var string |
|
| 495 | - */ |
|
| 496 | - public $custom_fields_config_str_json; |
|
| 497 | - |
|
| 498 | - /** |
|
| 499 | - * The address notes |
|
| 500 | - * @var AddressNote[] |
|
| 501 | - */ |
|
| 502 | - public $notes = []; |
|
| 503 | - |
|
| 504 | - /** |
|
| 505 | - * Bundle count |
|
| 506 | - * @var integer |
|
| 507 | - */ |
|
| 508 | - public $bundle_count; |
|
| 509 | - |
|
| 510 | - /** |
|
| 511 | - * Bundle items |
|
| 512 | - * @var BundledItemResponse[] |
|
| 513 | - */ |
|
| 514 | - public $bundle_items; |
|
| 515 | - |
|
| 516 | - /** |
|
| 517 | - * List of the order inventories |
|
| 518 | - * @var OrderInventory[] |
|
| 519 | - */ |
|
| 520 | - public $order_inventory; |
|
| 521 | - |
|
| 522 | - /** |
|
| 523 | - * UDU distance to next destination. |
|
| 524 | - * @var double |
|
| 525 | - */ |
|
| 526 | - public $udu_distance_to_next_destination; |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * Wait time to next destination. |
|
| 530 | - * @var integer |
|
| 531 | - */ |
|
| 532 | - public $wait_time_to_next_destination; |
|
| 533 | - |
|
| 534 | - /** |
|
| 535 | - * Manifest of a route address. |
|
| 536 | - * @var AddressManifest |
|
| 537 | - */ |
|
| 538 | - public $manifest; |
|
| 539 | - |
|
| 540 | - /** |
|
| 541 | - * An array of the required driver skills for the address. |
|
| 542 | - * @var array |
|
| 543 | - */ |
|
| 544 | - public $required_skills = []; |
|
| 545 | - |
|
| 546 | - public $additional_status; |
|
| 547 | - |
|
| 548 | - public function __construct() |
|
| 549 | - { |
|
| 550 | - // TO DO: replace with API 5 endpoint after finishing. |
|
| 551 | - Route4Me::setBaseUrl(Endpoint4::BASE_URL); |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - public static function getAddress($routeId, $addressId) |
|
| 555 | - { |
|
| 556 | - $address = Route4Me::makeRequst([ |
|
| 557 | - 'url' => Endpoint4::ADDRESS_V4, |
|
| 558 | - 'method' => 'GET', |
|
| 559 | - 'query' => [ |
|
| 560 | - 'route_id' => $routeId, |
|
| 561 | - 'route_destination_id' => $addressId, |
|
| 562 | - ], |
|
| 563 | - ]); |
|
| 564 | - |
|
| 565 | - return self::fromArray($address); |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - public function update() |
|
| 569 | - { |
|
| 570 | - $addressUpdate = Route4Me::makeRequst([ |
|
| 571 | - 'url' => Endpoint4::ADDRESS_V4, |
|
| 572 | - 'method' => 'PUT', |
|
| 573 | - 'body' => $this->toArray(), |
|
| 574 | - 'query' => [ |
|
| 575 | - 'route_id' => $this->route_id, |
|
| 576 | - 'route_destination_id' => $this->route_destination_id, |
|
| 577 | - ], |
|
| 578 | - ]); |
|
| 579 | - |
|
| 580 | - return self::fromArray($addressUpdate); |
|
| 581 | - } |
|
| 582 | - |
|
| 583 | - /** |
|
| 584 | - * Marks an address as marked as visited/as departed |
|
| 585 | - * depending on which parameter is specified: 'is_visited' or 'is_departed'. |
|
| 586 | - */ |
|
| 587 | - public function markAddress($params) |
|
| 588 | - { |
|
| 589 | - $allQueryFields = ['route_id', 'route_destination_id']; |
|
| 590 | - $allBodyFields = ['is_visited', 'is_departed']; |
|
| 591 | - |
|
| 592 | - $result = Route4Me::makeRequst([ |
|
| 593 | - 'url' => Endpoint4::ADDRESS_V4, |
|
| 594 | - 'method' => 'PUT', |
|
| 595 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 596 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 597 | - ]); |
|
| 598 | - |
|
| 599 | - return $result; |
|
| 600 | - } |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * Marks an address as departed. |
|
| 604 | - */ |
|
| 605 | - public function markAsDeparted($params) |
|
| 606 | - { |
|
| 607 | - $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
| 608 | - |
|
| 609 | - $address = Route4Me::makeRequst([ |
|
| 610 | - 'url' => Endpoint4::MARK_ADDRESS_DEPARTED, |
|
| 611 | - 'method' => 'PUT', |
|
| 612 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 613 | - ]); |
|
| 614 | - |
|
| 615 | - return $address; |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - /** |
|
| 619 | - * Marks an address as visited. |
|
| 620 | - */ |
|
| 621 | - public function markAsVisited($params) |
|
| 622 | - { |
|
| 623 | - $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
| 624 | - |
|
| 625 | - $address = Route4Me::makeRequst([ |
|
| 626 | - 'url' => Endpoint4::UPDATE_ADDRESS_VISITED, |
|
| 627 | - 'method' => 'PUT', |
|
| 628 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 629 | - ]); |
|
| 630 | - |
|
| 631 | - return $address; |
|
| 632 | - } |
|
| 633 | - |
|
| 634 | - public function deleteAddress() |
|
| 635 | - { |
|
| 636 | - $address = Route4Me::makeRequst([ |
|
| 637 | - 'url' => Endpoint4::ADDRESS_V4, |
|
| 638 | - 'method' => 'DELETE', |
|
| 639 | - 'query' => [ |
|
| 640 | - 'route_id' => $this->route_id, |
|
| 641 | - 'route_destination_id' => $this->route_destination_id, |
|
| 642 | - ], |
|
| 643 | - ]); |
|
| 644 | - |
|
| 645 | - return (bool)$address['deleted']; |
|
| 646 | - } |
|
| 647 | - |
|
| 648 | - public function moveDestinationToRoute($params) |
|
| 649 | - { |
|
| 650 | - $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
| 651 | - |
|
| 652 | - $result = Route4Me::makeRequst([ |
|
| 653 | - 'url' => Endpoint4::MOVE_ROUTE_DESTINATION, |
|
| 654 | - 'method' => 'POST', |
|
| 655 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 656 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 657 | - ]); |
|
| 658 | - |
|
| 659 | - return $result; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - public function getAddressId() |
|
| 663 | - { |
|
| 664 | - return $this->route_destination_id; |
|
| 665 | - } |
|
| 17 | + /** |
|
| 18 | + * Route destination ID |
|
| 19 | + * @var integer |
|
| 20 | + */ |
|
| 21 | + public $route_destination_id; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Route alias |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + public $alias; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * The ID of the member inside the Route4Me system. |
|
| 31 | + * @var integer |
|
| 32 | + */ |
|
| 33 | + public $member_id; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Route destination address |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | + public $address; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Designate this stop as a depot. |
|
| 43 | + * A route may have multiple depots/points of origin. |
|
| 44 | + * @var boolean |
|
| 45 | + */ |
|
| 46 | + public $is_depot; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Timeframe violation state |
|
| 50 | + * @var integer |
|
| 51 | + */ |
|
| 52 | + public $timeframe_violation_state; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Timeframe violation time |
|
| 56 | + * @var integer |
|
| 57 | + */ |
|
| 58 | + public $timeframe_violation_time; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Timeframe violation rate |
|
| 62 | + * @var double |
|
| 63 | + */ |
|
| 64 | + public $timeframe_violation_rate; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * The latitude of this address |
|
| 68 | + * @var double |
|
| 69 | + */ |
|
| 70 | + public $lat; |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * The longitude of this address |
|
| 74 | + * @var double |
|
| 75 | + */ |
|
| 76 | + public $lng; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Curbside latitude. |
|
| 80 | + * Generate optimal routes and driving directions to this curbside latitude. |
|
| 81 | + * @var double |
|
| 82 | + */ |
|
| 83 | + public $curbside_lat; |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Curbside longitude. |
|
| 87 | + * Generate optimal routes and driving directions to the curbside longitude. |
|
| 88 | + * @var double |
|
| 89 | + */ |
|
| 90 | + public $curbside_lng; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * If present, the priority will sequence addresses in all the optimal routes so that |
|
| 94 | + * higher priority addresses are general at the beginning of the route sequence. |
|
| 95 | + * 1 is the highest priority, 100000 is the lowest. |
|
| 96 | + * @var integer |
|
| 97 | + */ |
|
| 98 | + public $priority; |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * The ID of the route being viewed, modified, or erased. |
|
| 102 | + * @var string |
|
| 103 | + */ |
|
| 104 | + public $route_id; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * If this route was duplicated from an existing route, |
|
| 108 | + * this value would have the original route's ID. |
|
| 109 | + * @var string |
|
| 110 | + */ |
|
| 111 | + public $original_route_id; |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Route name of a depot address. |
|
| 115 | + * @var string |
|
| 116 | + */ |
|
| 117 | + public $route_name; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The ID of the optimization request that was used to initially instantiate this route. |
|
| 121 | + * @var string |
|
| 122 | + */ |
|
| 123 | + public $optimization_problem_id; |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * The destination's sequence number in the route. |
|
| 127 | + * @var integer |
|
| 128 | + */ |
|
| 129 | + public $sequence_no; |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * True if the address is geocoded. |
|
| 133 | + * @var boolean |
|
| 134 | + */ |
|
| 135 | + public $geocoded; |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * The preferred geocoding number. |
|
| 139 | + * @var integer |
|
| 140 | + */ |
|
| 141 | + public $preferred_geocoding; |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * True if geocoding failed. |
|
| 145 | + * @var boolean |
|
| 146 | + */ |
|
| 147 | + public $failed_geocoding; |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * An array containing Geocoding objects. |
|
| 151 | + * @var Geocoding[] |
|
| 152 | + */ |
|
| 153 | + public $geocodings = []; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * When planning a route from the address book or using existing address book IDs, |
|
| 157 | + * pass the address book ID (contact_id) for an address so that Route4Me can run |
|
| 158 | + * analytics on the address book addresses that were used to plan routes, and to find previous visits to |
|
| 159 | + * favorite addresses. |
|
| 160 | + * @var integer |
|
| 161 | + */ |
|
| 162 | + public $contact_id; |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * The address order ID |
|
| 166 | + * @var integer |
|
| 167 | + */ |
|
| 168 | + public $order_id; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Route address stop type |
|
| 172 | + * @var string |
|
| 173 | + */ |
|
| 174 | + public $address_stop_type; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * The status flag to mark an address as visited (aka check in). |
|
| 178 | + * @var boolean |
|
| 179 | + */ |
|
| 180 | + public $is_visited; |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * The last known visited timestamp of this address. |
|
| 184 | + * @var integer |
|
| 185 | + */ |
|
| 186 | + public $timestamp_last_visited; |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Latitude of the visited address |
|
| 190 | + * @var double |
|
| 191 | + */ |
|
| 192 | + public $visited_lat; |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Longitude of the visited address |
|
| 196 | + * @var double |
|
| 197 | + */ |
|
| 198 | + public $visited_lng; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * The status flag to mark an address as departed (aka check out). |
|
| 202 | + * @var boolean |
|
| 203 | + */ |
|
| 204 | + public $is_departed; |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Departed address latitude |
|
| 208 | + * @var double |
|
| 209 | + */ |
|
| 210 | + public $departed_lat; |
|
| 211 | + |
|
| 212 | + /** Departed address longitude |
|
| 213 | + * @var double |
|
| 214 | + */ |
|
| 215 | + public $departed_lng; |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * he last known departed timestamp of this address. |
|
| 219 | + * @var integer |
|
| 220 | + */ |
|
| 221 | + public $timestamp_last_departed; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * The address group |
|
| 225 | + * @var string |
|
| 226 | + */ |
|
| 227 | + public $group; |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * Pass-through data about this route destination.<br> |
|
| 231 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 232 | + * @var string |
|
| 233 | + */ |
|
| 234 | + public $customer_po; |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Pass-through data about this route destination.<br> |
|
| 238 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 239 | + * @var string |
|
| 240 | + */ |
|
| 241 | + public $invoice_no; |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Pass-through data about this route destination.<br> |
|
| 245 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 246 | + * @var string |
|
| 247 | + */ |
|
| 248 | + public $reference_no; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * Pass-through data about this route destination.<br> |
|
| 252 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 253 | + * @var string |
|
| 254 | + */ |
|
| 255 | + public $order_no; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * The address cargo weight |
|
| 259 | + * @var double |
|
| 260 | + */ |
|
| 261 | + public $weight; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * The address cost |
|
| 265 | + * @var double |
|
| 266 | + */ |
|
| 267 | + public $cost; |
|
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * The address revenue |
|
| 271 | + * @var double |
|
| 272 | + */ |
|
| 273 | + public $revenue; |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * The cubic volume that this destination/order/line-item consumes/contains.<br> |
|
| 277 | + * This is how much space it will take up on a vehicle. |
|
| 278 | + * @var double |
|
| 279 | + */ |
|
| 280 | + public $cube; |
|
| 281 | + |
|
| 282 | + /** |
|
| 283 | + * The number of pieces/palllets that this destination/order/line-item consumes/contains on a vehicle. |
|
| 284 | + * @var integer |
|
| 285 | + */ |
|
| 286 | + public $pieces; |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * First name |
|
| 290 | + * @var string |
|
| 291 | + */ |
|
| 292 | + public $first_name; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * Last name |
|
| 296 | + * @var string |
|
| 297 | + */ |
|
| 298 | + public $last_name; |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * Pass-through data about this route destination. |
|
| 302 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 303 | + * Also used to email clients when vehicles are approaching (future capability). |
|
| 304 | + * @var string |
|
| 305 | + */ |
|
| 306 | + public $email; |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Pass-through data about this route destination. |
|
| 310 | + * The data will be visible on the manifest, website, and mobile apps. |
|
| 311 | + * Also used to send SMS messages to clients when vehicles are approaching (future capability). |
|
| 312 | + * @var string |
|
| 313 | + */ |
|
| 314 | + public $phone; |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * The number of notes that are already associated with this address on the route. |
|
| 318 | + * @var integer |
|
| 319 | + */ |
|
| 320 | + public $destination_note_count; |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * Server-side generated amount of km/miles that |
|
| 324 | + * it will take to get to the next location on the route. |
|
| 325 | + * @var integer |
|
| 326 | + */ |
|
| 327 | + public $drive_time_to_next_destination; |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * Abnormal traffic time to next destination. |
|
| 331 | + * @var integer |
|
| 332 | + */ |
|
| 333 | + public $abnormal_traffic_time_to_next_destination; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * Uncongested time to next destination. |
|
| 337 | + * @var integer |
|
| 338 | + */ |
|
| 339 | + public $uncongested_time_to_next_destination; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Traffic time to next destination. |
|
| 343 | + * @var integer |
|
| 344 | + */ |
|
| 345 | + public $traffic_time_to_next_destination; |
|
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * Server-side generated amount of seconds |
|
| 349 | + * that it will take to get to the next location. |
|
| 350 | + * @var double |
|
| 351 | + */ |
|
| 352 | + public $distance_to_next_destination; |
|
| 353 | + |
|
| 354 | + /** |
|
| 355 | + * The unique socket channel name which |
|
| 356 | + * should be used to get real time alerts. |
|
| 357 | + * @var string |
|
| 358 | + */ |
|
| 359 | + public $channel_name; |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * Alias of a pickup point. |
|
| 363 | + * @var string |
|
| 364 | + */ |
|
| 365 | + public $pickup; |
|
| 366 | + |
|
| 367 | + /** |
|
| 368 | + * Alias of the paired pickup point. |
|
| 369 | + * @var string |
|
| 370 | + */ |
|
| 371 | + public $dropoff; |
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * If equal to 1, the pickup and dropoff addresses are joint |
|
| 375 | + * (one by one despite the regular pickup-dropoff addresses |
|
| 376 | + * when it's possible to have multiple pickup addresses with one dropoff address). |
|
| 377 | + * @var integer |
|
| 378 | + */ |
|
| 379 | + public $joint; |
|
| 380 | + |
|
| 381 | + /** |
|
| 382 | + * Generated time window start. |
|
| 383 | + * @var integer |
|
| 384 | + */ |
|
| 385 | + public $generated_time_window_start; |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Estimated time window end based on the optimization engine, |
|
| 389 | + * after all the sequencing has been completed. |
|
| 390 | + * @var integer |
|
| 391 | + */ |
|
| 392 | + public $generated_time_window_end; |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * The address time window start. |
|
| 396 | + * @var integer |
|
| 397 | + */ |
|
| 398 | + public $time_window_start; |
|
| 399 | + |
|
| 400 | + /** |
|
| 401 | + * The address time window end. |
|
| 402 | + * @var integer |
|
| 403 | + */ |
|
| 404 | + public $time_window_end; |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * The address time window start 2. |
|
| 408 | + * @var integer |
|
| 409 | + */ |
|
| 410 | + public $time_window_start_2; |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * The address time window end 2. |
|
| 414 | + * @var integer |
|
| 415 | + */ |
|
| 416 | + public $time_window_end_2; |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Geofence detected visited timestamp |
|
| 420 | + * @var integer |
|
| 421 | + */ |
|
| 422 | + public $geofence_detected_visited_timestamp; |
|
| 423 | + |
|
| 424 | + /** |
|
| 425 | + * Geofence detected departed timestamp |
|
| 426 | + * @var integer |
|
| 427 | + */ |
|
| 428 | + public $geofence_detected_departed_timestamp; |
|
| 429 | + |
|
| 430 | + /** |
|
| 431 | + * Geofence detected service time |
|
| 432 | + * @var integer |
|
| 433 | + */ |
|
| 434 | + public $geofence_detected_service_time; |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Geofence detected visited latitude |
|
| 438 | + * @var double |
|
| 439 | + */ |
|
| 440 | + public $geofence_detected_visited_lat; |
|
| 441 | + |
|
| 442 | + /** |
|
| 443 | + * Geofence detected visited longitude |
|
| 444 | + * @var double |
|
| 445 | + */ |
|
| 446 | + public $geofence_detected_visited_lng; |
|
| 447 | + |
|
| 448 | + /** |
|
| 449 | + * Geofence detected departed latitude |
|
| 450 | + * @var double |
|
| 451 | + */ |
|
| 452 | + public $geofence_detected_departed_lat; |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * Geofence detected departed longitude |
|
| 456 | + * @var double |
|
| 457 | + */ |
|
| 458 | + public $geofence_detected_departed_lng; |
|
| 459 | + |
|
| 460 | + /** |
|
| 461 | + * The expected amount of time that will be spent |
|
| 462 | + * at this address by the driver/user. |
|
| 463 | + * @var integer |
|
| 464 | + */ |
|
| 465 | + public $time; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * System-wide unique code, which permits end-users (recipients) |
|
| 469 | + * to track the status of their order. |
|
| 470 | + * @var string |
|
| 471 | + */ |
|
| 472 | + public $tracking_number; |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * The address custom fields. |
|
| 476 | + * @var array |
|
| 477 | + */ |
|
| 478 | + public $custom_fields = []; |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * The custom fields configuration in JSON format. |
|
| 482 | + * @var string |
|
| 483 | + */ |
|
| 484 | + public $custom_fields_str_json; |
|
| 485 | + |
|
| 486 | + /** |
|
| 487 | + * The custom fields configuration. |
|
| 488 | + * @var string[] |
|
| 489 | + */ |
|
| 490 | + public $custom_fields_config = []; |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * The custom fields configuration in JSON format. |
|
| 494 | + * @var string |
|
| 495 | + */ |
|
| 496 | + public $custom_fields_config_str_json; |
|
| 497 | + |
|
| 498 | + /** |
|
| 499 | + * The address notes |
|
| 500 | + * @var AddressNote[] |
|
| 501 | + */ |
|
| 502 | + public $notes = []; |
|
| 503 | + |
|
| 504 | + /** |
|
| 505 | + * Bundle count |
|
| 506 | + * @var integer |
|
| 507 | + */ |
|
| 508 | + public $bundle_count; |
|
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * Bundle items |
|
| 512 | + * @var BundledItemResponse[] |
|
| 513 | + */ |
|
| 514 | + public $bundle_items; |
|
| 515 | + |
|
| 516 | + /** |
|
| 517 | + * List of the order inventories |
|
| 518 | + * @var OrderInventory[] |
|
| 519 | + */ |
|
| 520 | + public $order_inventory; |
|
| 521 | + |
|
| 522 | + /** |
|
| 523 | + * UDU distance to next destination. |
|
| 524 | + * @var double |
|
| 525 | + */ |
|
| 526 | + public $udu_distance_to_next_destination; |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * Wait time to next destination. |
|
| 530 | + * @var integer |
|
| 531 | + */ |
|
| 532 | + public $wait_time_to_next_destination; |
|
| 533 | + |
|
| 534 | + /** |
|
| 535 | + * Manifest of a route address. |
|
| 536 | + * @var AddressManifest |
|
| 537 | + */ |
|
| 538 | + public $manifest; |
|
| 539 | + |
|
| 540 | + /** |
|
| 541 | + * An array of the required driver skills for the address. |
|
| 542 | + * @var array |
|
| 543 | + */ |
|
| 544 | + public $required_skills = []; |
|
| 545 | + |
|
| 546 | + public $additional_status; |
|
| 547 | + |
|
| 548 | + public function __construct() |
|
| 549 | + { |
|
| 550 | + // TO DO: replace with API 5 endpoint after finishing. |
|
| 551 | + Route4Me::setBaseUrl(Endpoint4::BASE_URL); |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + public static function getAddress($routeId, $addressId) |
|
| 555 | + { |
|
| 556 | + $address = Route4Me::makeRequst([ |
|
| 557 | + 'url' => Endpoint4::ADDRESS_V4, |
|
| 558 | + 'method' => 'GET', |
|
| 559 | + 'query' => [ |
|
| 560 | + 'route_id' => $routeId, |
|
| 561 | + 'route_destination_id' => $addressId, |
|
| 562 | + ], |
|
| 563 | + ]); |
|
| 564 | + |
|
| 565 | + return self::fromArray($address); |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + public function update() |
|
| 569 | + { |
|
| 570 | + $addressUpdate = Route4Me::makeRequst([ |
|
| 571 | + 'url' => Endpoint4::ADDRESS_V4, |
|
| 572 | + 'method' => 'PUT', |
|
| 573 | + 'body' => $this->toArray(), |
|
| 574 | + 'query' => [ |
|
| 575 | + 'route_id' => $this->route_id, |
|
| 576 | + 'route_destination_id' => $this->route_destination_id, |
|
| 577 | + ], |
|
| 578 | + ]); |
|
| 579 | + |
|
| 580 | + return self::fromArray($addressUpdate); |
|
| 581 | + } |
|
| 582 | + |
|
| 583 | + /** |
|
| 584 | + * Marks an address as marked as visited/as departed |
|
| 585 | + * depending on which parameter is specified: 'is_visited' or 'is_departed'. |
|
| 586 | + */ |
|
| 587 | + public function markAddress($params) |
|
| 588 | + { |
|
| 589 | + $allQueryFields = ['route_id', 'route_destination_id']; |
|
| 590 | + $allBodyFields = ['is_visited', 'is_departed']; |
|
| 591 | + |
|
| 592 | + $result = Route4Me::makeRequst([ |
|
| 593 | + 'url' => Endpoint4::ADDRESS_V4, |
|
| 594 | + 'method' => 'PUT', |
|
| 595 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 596 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 597 | + ]); |
|
| 598 | + |
|
| 599 | + return $result; |
|
| 600 | + } |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * Marks an address as departed. |
|
| 604 | + */ |
|
| 605 | + public function markAsDeparted($params) |
|
| 606 | + { |
|
| 607 | + $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
| 608 | + |
|
| 609 | + $address = Route4Me::makeRequst([ |
|
| 610 | + 'url' => Endpoint4::MARK_ADDRESS_DEPARTED, |
|
| 611 | + 'method' => 'PUT', |
|
| 612 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 613 | + ]); |
|
| 614 | + |
|
| 615 | + return $address; |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + /** |
|
| 619 | + * Marks an address as visited. |
|
| 620 | + */ |
|
| 621 | + public function markAsVisited($params) |
|
| 622 | + { |
|
| 623 | + $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
| 624 | + |
|
| 625 | + $address = Route4Me::makeRequst([ |
|
| 626 | + 'url' => Endpoint4::UPDATE_ADDRESS_VISITED, |
|
| 627 | + 'method' => 'PUT', |
|
| 628 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 629 | + ]); |
|
| 630 | + |
|
| 631 | + return $address; |
|
| 632 | + } |
|
| 633 | + |
|
| 634 | + public function deleteAddress() |
|
| 635 | + { |
|
| 636 | + $address = Route4Me::makeRequst([ |
|
| 637 | + 'url' => Endpoint4::ADDRESS_V4, |
|
| 638 | + 'method' => 'DELETE', |
|
| 639 | + 'query' => [ |
|
| 640 | + 'route_id' => $this->route_id, |
|
| 641 | + 'route_destination_id' => $this->route_destination_id, |
|
| 642 | + ], |
|
| 643 | + ]); |
|
| 644 | + |
|
| 645 | + return (bool)$address['deleted']; |
|
| 646 | + } |
|
| 647 | + |
|
| 648 | + public function moveDestinationToRoute($params) |
|
| 649 | + { |
|
| 650 | + $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
| 651 | + |
|
| 652 | + $result = Route4Me::makeRequst([ |
|
| 653 | + 'url' => Endpoint4::MOVE_ROUTE_DESTINATION, |
|
| 654 | + 'method' => 'POST', |
|
| 655 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 656 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 657 | + ]); |
|
| 658 | + |
|
| 659 | + return $result; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + public function getAddressId() |
|
| 663 | + { |
|
| 664 | + return $this->route_destination_id; |
|
| 665 | + } |
|
| 666 | 666 | } |
@@ -13,207 +13,207 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class AddressNote extends \Route4Me\Common |
| 15 | 15 | { |
| 16 | - /** An unique ID of a note |
|
| 17 | - * @var integer $note_id |
|
| 18 | - */ |
|
| 19 | - public $note_id; |
|
| 20 | - |
|
| 21 | - /** The route ID |
|
| 22 | - * @var string $route_id |
|
| 23 | - */ |
|
| 24 | - public $route_id; |
|
| 25 | - |
|
| 26 | - /** The route destination ID |
|
| 27 | - * @var integer $route_destination_id |
|
| 28 | - */ |
|
| 29 | - public $route_destination_id; |
|
| 30 | - |
|
| 31 | - /** An unique ID of an uploaded file |
|
| 32 | - * @var string $upload_id |
|
| 33 | - */ |
|
| 34 | - public $upload_id; |
|
| 35 | - |
|
| 36 | - /** When the note was added |
|
| 37 | - * @var integer $ts_added |
|
| 38 | - */ |
|
| 39 | - public $ts_added; |
|
| 40 | - |
|
| 41 | - /** The position latitude where the address note was added |
|
| 42 | - * @var double $lat |
|
| 43 | - */ |
|
| 44 | - public $lat; |
|
| 45 | - |
|
| 46 | - /** The position longitude where the address note was added |
|
| 47 | - * @var double $lng |
|
| 48 | - */ |
|
| 49 | - public $lng; |
|
| 50 | - |
|
| 51 | - /** The activity type |
|
| 52 | - * @var string $activity_type |
|
| 53 | - */ |
|
| 54 | - public $activity_type; |
|
| 55 | - |
|
| 56 | - /** The note text contents |
|
| 57 | - * @var string $contents |
|
| 58 | - */ |
|
| 59 | - public $contents; |
|
| 60 | - |
|
| 61 | - /** An upload type of the note |
|
| 62 | - * @var string $upload_type |
|
| 63 | - */ |
|
| 64 | - public $upload_type; |
|
| 65 | - |
|
| 66 | - /** An upload url - where a file-note was uploaded. |
|
| 67 | - * @var string $upload_url |
|
| 68 | - */ |
|
| 69 | - public $upload_url; |
|
| 70 | - |
|
| 71 | - /** An extension of the uploaded file. |
|
| 72 | - * @var string $upload_extension |
|
| 73 | - */ |
|
| 74 | - public $upload_extension; |
|
| 75 | - |
|
| 76 | - /** The device a note was uploaded from |
|
| 77 | - * @var string $device_type |
|
| 78 | - */ |
|
| 79 | - public $device_type; |
|
| 80 | - |
|
| 81 | - /** Array of the custom type notes |
|
| 82 | - * @var AddressCustomNote[] $custom_types |
|
| 83 | - */ |
|
| 84 | - public $custom_types = []; |
|
| 85 | - |
|
| 86 | - public function __construct() |
|
| 87 | - { |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /*Get notes from the specified route destination |
|
| 16 | + /** An unique ID of a note |
|
| 17 | + * @var integer $note_id |
|
| 18 | + */ |
|
| 19 | + public $note_id; |
|
| 20 | + |
|
| 21 | + /** The route ID |
|
| 22 | + * @var string $route_id |
|
| 23 | + */ |
|
| 24 | + public $route_id; |
|
| 25 | + |
|
| 26 | + /** The route destination ID |
|
| 27 | + * @var integer $route_destination_id |
|
| 28 | + */ |
|
| 29 | + public $route_destination_id; |
|
| 30 | + |
|
| 31 | + /** An unique ID of an uploaded file |
|
| 32 | + * @var string $upload_id |
|
| 33 | + */ |
|
| 34 | + public $upload_id; |
|
| 35 | + |
|
| 36 | + /** When the note was added |
|
| 37 | + * @var integer $ts_added |
|
| 38 | + */ |
|
| 39 | + public $ts_added; |
|
| 40 | + |
|
| 41 | + /** The position latitude where the address note was added |
|
| 42 | + * @var double $lat |
|
| 43 | + */ |
|
| 44 | + public $lat; |
|
| 45 | + |
|
| 46 | + /** The position longitude where the address note was added |
|
| 47 | + * @var double $lng |
|
| 48 | + */ |
|
| 49 | + public $lng; |
|
| 50 | + |
|
| 51 | + /** The activity type |
|
| 52 | + * @var string $activity_type |
|
| 53 | + */ |
|
| 54 | + public $activity_type; |
|
| 55 | + |
|
| 56 | + /** The note text contents |
|
| 57 | + * @var string $contents |
|
| 58 | + */ |
|
| 59 | + public $contents; |
|
| 60 | + |
|
| 61 | + /** An upload type of the note |
|
| 62 | + * @var string $upload_type |
|
| 63 | + */ |
|
| 64 | + public $upload_type; |
|
| 65 | + |
|
| 66 | + /** An upload url - where a file-note was uploaded. |
|
| 67 | + * @var string $upload_url |
|
| 68 | + */ |
|
| 69 | + public $upload_url; |
|
| 70 | + |
|
| 71 | + /** An extension of the uploaded file. |
|
| 72 | + * @var string $upload_extension |
|
| 73 | + */ |
|
| 74 | + public $upload_extension; |
|
| 75 | + |
|
| 76 | + /** The device a note was uploaded from |
|
| 77 | + * @var string $device_type |
|
| 78 | + */ |
|
| 79 | + public $device_type; |
|
| 80 | + |
|
| 81 | + /** Array of the custom type notes |
|
| 82 | + * @var AddressCustomNote[] $custom_types |
|
| 83 | + */ |
|
| 84 | + public $custom_types = []; |
|
| 85 | + |
|
| 86 | + public function __construct() |
|
| 87 | + { |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /*Get notes from the specified route destination |
|
| 91 | 91 | * Returns an address object with notes, if an address exists, otherwise - return null. |
| 92 | 92 | */ |
| 93 | - public static function GetAddressesNotes($noteParams) |
|
| 94 | - { |
|
| 95 | - $address = Route4Me::makeRequst([ |
|
| 96 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 97 | - 'method' => 'GET', |
|
| 98 | - 'query' => [ |
|
| 99 | - 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, |
|
| 100 | - 'route_destination_id' => isset($noteParams['route_destination_id']) |
|
| 101 | - ? $noteParams['route_destination_id'] : null, |
|
| 102 | - 'notes' => 1, |
|
| 103 | - ], |
|
| 104 | - ]); |
|
| 105 | - |
|
| 106 | - return $address; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - public function createCustomNoteType($params) |
|
| 110 | - { |
|
| 111 | - $allBodyFields = ['type', 'values']; |
|
| 112 | - |
|
| 113 | - $result = Route4Me::makeRequst([ |
|
| 114 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 115 | - 'method' => 'POST', |
|
| 116 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 117 | - ]); |
|
| 118 | - |
|
| 119 | - return $result; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - public function removeCustomNoteType($params) |
|
| 123 | - { |
|
| 124 | - $result = Route4Me::makeRequst([ |
|
| 125 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 126 | - 'method' => 'DELETE', |
|
| 127 | - 'body' => [ |
|
| 128 | - 'id' => isset($params['id']) ? $params['id'] : null, |
|
| 129 | - ], |
|
| 130 | - ]); |
|
| 131 | - |
|
| 132 | - return $result; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - public function getAllCustomNoteTypes() |
|
| 136 | - { |
|
| 137 | - $result = Route4Me::makeRequst([ |
|
| 138 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 139 | - 'method' => 'GET', |
|
| 140 | - ]); |
|
| 141 | - |
|
| 142 | - return $result; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - public function getCustomNoteTypeByKey($params) |
|
| 146 | - { |
|
| 147 | - $result = Route4Me::makeRequst([ |
|
| 148 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 149 | - 'method' => 'GET', |
|
| 150 | - ]); |
|
| 151 | - |
|
| 152 | - if (is_null($result) || !is_array($result)) return null; |
|
| 153 | - |
|
| 154 | - foreach ($result as $custNoteType) { |
|
| 155 | - if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) { |
|
| 156 | - return $custNoteType; |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - public function AddAddressNote($params) |
|
| 162 | - { |
|
| 163 | - $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type']; |
|
| 164 | - $allBodyFields = ['strNoteContents', 'strUpdateType']; |
|
| 165 | - |
|
| 166 | - $result = Route4Me::makeRequst([ |
|
| 167 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 168 | - 'method' => 'POST', |
|
| 169 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 170 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 171 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 172 | - ]); |
|
| 173 | - |
|
| 174 | - return $result; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - public function AddNoteFile($params) |
|
| 178 | - { |
|
| 179 | - $fname = isset($params['strFilename']) ? $params['strFilename'] : null; |
|
| 180 | - |
|
| 181 | - $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type']; |
|
| 182 | - $allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents']; |
|
| 183 | - |
|
| 184 | - $result = Route4Me::makeRequst([ |
|
| 185 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 186 | - 'method' => 'POST', |
|
| 187 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 188 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 189 | - 'FILE' => $fname, |
|
| 190 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 191 | - ]); |
|
| 192 | - |
|
| 193 | - return $result; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - public function addCustomNoteToRoute($params) |
|
| 197 | - { |
|
| 198 | - $customArray = []; |
|
| 199 | - |
|
| 200 | - foreach ($params as $key => $value) { |
|
| 201 | - if (false !== strpos($key, 'custom_note_type')) { |
|
| 202 | - $customArray[$key] = $value; |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - $allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng']; |
|
| 207 | - $allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents']; |
|
| 208 | - |
|
| 209 | - $result = Route4Me::makeRequst([ |
|
| 210 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 211 | - 'method' => 'POST', |
|
| 212 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 213 | - 'body' => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray), |
|
| 214 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 215 | - ]); |
|
| 216 | - |
|
| 217 | - return $result; |
|
| 218 | - } |
|
| 93 | + public static function GetAddressesNotes($noteParams) |
|
| 94 | + { |
|
| 95 | + $address = Route4Me::makeRequst([ |
|
| 96 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 97 | + 'method' => 'GET', |
|
| 98 | + 'query' => [ |
|
| 99 | + 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, |
|
| 100 | + 'route_destination_id' => isset($noteParams['route_destination_id']) |
|
| 101 | + ? $noteParams['route_destination_id'] : null, |
|
| 102 | + 'notes' => 1, |
|
| 103 | + ], |
|
| 104 | + ]); |
|
| 105 | + |
|
| 106 | + return $address; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + public function createCustomNoteType($params) |
|
| 110 | + { |
|
| 111 | + $allBodyFields = ['type', 'values']; |
|
| 112 | + |
|
| 113 | + $result = Route4Me::makeRequst([ |
|
| 114 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 115 | + 'method' => 'POST', |
|
| 116 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 117 | + ]); |
|
| 118 | + |
|
| 119 | + return $result; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + public function removeCustomNoteType($params) |
|
| 123 | + { |
|
| 124 | + $result = Route4Me::makeRequst([ |
|
| 125 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 126 | + 'method' => 'DELETE', |
|
| 127 | + 'body' => [ |
|
| 128 | + 'id' => isset($params['id']) ? $params['id'] : null, |
|
| 129 | + ], |
|
| 130 | + ]); |
|
| 131 | + |
|
| 132 | + return $result; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + public function getAllCustomNoteTypes() |
|
| 136 | + { |
|
| 137 | + $result = Route4Me::makeRequst([ |
|
| 138 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 139 | + 'method' => 'GET', |
|
| 140 | + ]); |
|
| 141 | + |
|
| 142 | + return $result; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + public function getCustomNoteTypeByKey($params) |
|
| 146 | + { |
|
| 147 | + $result = Route4Me::makeRequst([ |
|
| 148 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 149 | + 'method' => 'GET', |
|
| 150 | + ]); |
|
| 151 | + |
|
| 152 | + if (is_null($result) || !is_array($result)) return null; |
|
| 153 | + |
|
| 154 | + foreach ($result as $custNoteType) { |
|
| 155 | + if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) { |
|
| 156 | + return $custNoteType; |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + public function AddAddressNote($params) |
|
| 162 | + { |
|
| 163 | + $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type']; |
|
| 164 | + $allBodyFields = ['strNoteContents', 'strUpdateType']; |
|
| 165 | + |
|
| 166 | + $result = Route4Me::makeRequst([ |
|
| 167 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 168 | + 'method' => 'POST', |
|
| 169 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 170 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 171 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 172 | + ]); |
|
| 173 | + |
|
| 174 | + return $result; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + public function AddNoteFile($params) |
|
| 178 | + { |
|
| 179 | + $fname = isset($params['strFilename']) ? $params['strFilename'] : null; |
|
| 180 | + |
|
| 181 | + $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type']; |
|
| 182 | + $allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents']; |
|
| 183 | + |
|
| 184 | + $result = Route4Me::makeRequst([ |
|
| 185 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 186 | + 'method' => 'POST', |
|
| 187 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 188 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 189 | + 'FILE' => $fname, |
|
| 190 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 191 | + ]); |
|
| 192 | + |
|
| 193 | + return $result; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + public function addCustomNoteToRoute($params) |
|
| 197 | + { |
|
| 198 | + $customArray = []; |
|
| 199 | + |
|
| 200 | + foreach ($params as $key => $value) { |
|
| 201 | + if (false !== strpos($key, 'custom_note_type')) { |
|
| 202 | + $customArray[$key] = $value; |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + $allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng']; |
|
| 207 | + $allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents']; |
|
| 208 | + |
|
| 209 | + $result = Route4Me::makeRequst([ |
|
| 210 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 211 | + 'method' => 'POST', |
|
| 212 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 213 | + 'body' => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray), |
|
| 214 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 215 | + ]); |
|
| 216 | + |
|
| 217 | + return $result; |
|
| 218 | + } |
|
| 219 | 219 | } |
@@ -9,117 +9,117 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class Connection extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Telemetics connection name |
|
| 14 | - * @var type string |
|
| 15 | - */ |
|
| 16 | - public $name; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Telemetics connection type |
|
| 20 | - * @var type string |
|
| 21 | - */ |
|
| 22 | - public $vendor; |
|
| 12 | + /** |
|
| 13 | + * Telemetics connection name |
|
| 14 | + * @var type string |
|
| 15 | + */ |
|
| 16 | + public $name; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Telemetics connection type |
|
| 20 | + * @var type string |
|
| 21 | + */ |
|
| 22 | + public $vendor; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Telematics connection access host |
|
| 26 | - * @var type string |
|
| 27 | - */ |
|
| 28 | - public $host; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Telematics connection access api_key |
|
| 32 | - * @var type string |
|
| 33 | - */ |
|
| 34 | - public $api_key; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Telematics connection access account ID. |
|
| 38 | - * @var type string |
|
| 39 | - */ |
|
| 40 | - public $account_id; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Telematics connection access username |
|
| 44 | - * @var type string |
|
| 45 | - */ |
|
| 46 | - public $username; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Telematics connection access password |
|
| 50 | - * @var type string |
|
| 51 | - */ |
|
| 52 | - public $password; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Telematics connection access token |
|
| 56 | - * @var type string |
|
| 57 | - */ |
|
| 58 | - public $connection_token; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Telemetics connection type ID |
|
| 62 | - * @var type integer |
|
| 63 | - */ |
|
| 64 | - public $vendor_id; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Disable/enable vehicle tracking |
|
| 68 | - * @var type Boolean |
|
| 69 | - */ |
|
| 70 | - public $is_enabled; |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Vehicle tracking interval in seconds |
|
| 74 | - * @var type integer |
|
| 75 | - */ |
|
| 76 | - public $vehicle_position_refresh_rate; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Maximum idle time |
|
| 80 | - * @var type integer |
|
| 81 | - */ |
|
| 82 | - public $max_idle_time; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * Syncronized vehicles count |
|
| 86 | - * @var type integer |
|
| 87 | - */ |
|
| 88 | - public $synced_vehicles_count; |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Total vehicles count |
|
| 92 | - * @var type integer |
|
| 93 | - */ |
|
| 94 | - public $total_vehicles_count; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Total addresses count |
|
| 98 | - * @var type integer |
|
| 99 | - */ |
|
| 100 | - public $total_addresses_count; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * The last timestamp the vehicles reloaded |
|
| 104 | - * @var type string |
|
| 105 | - */ |
|
| 106 | - public $last_vehicles_reload; |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * The last timestamp the addresses reloaded |
|
| 110 | - * @var type string |
|
| 111 | - */ |
|
| 112 | - public $last_addresses_reload; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The last timestamp the postions reloaded |
|
| 116 | - * @var type string |
|
| 117 | - */ |
|
| 118 | - public $last_position_reload; |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Metadata, custom key-value storage. |
|
| 122 | - * @var type array |
|
| 123 | - */ |
|
| 124 | - public $metadata = []; |
|
| 24 | + /** |
|
| 25 | + * Telematics connection access host |
|
| 26 | + * @var type string |
|
| 27 | + */ |
|
| 28 | + public $host; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Telematics connection access api_key |
|
| 32 | + * @var type string |
|
| 33 | + */ |
|
| 34 | + public $api_key; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Telematics connection access account ID. |
|
| 38 | + * @var type string |
|
| 39 | + */ |
|
| 40 | + public $account_id; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Telematics connection access username |
|
| 44 | + * @var type string |
|
| 45 | + */ |
|
| 46 | + public $username; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Telematics connection access password |
|
| 50 | + * @var type string |
|
| 51 | + */ |
|
| 52 | + public $password; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Telematics connection access token |
|
| 56 | + * @var type string |
|
| 57 | + */ |
|
| 58 | + public $connection_token; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Telemetics connection type ID |
|
| 62 | + * @var type integer |
|
| 63 | + */ |
|
| 64 | + public $vendor_id; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Disable/enable vehicle tracking |
|
| 68 | + * @var type Boolean |
|
| 69 | + */ |
|
| 70 | + public $is_enabled; |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Vehicle tracking interval in seconds |
|
| 74 | + * @var type integer |
|
| 75 | + */ |
|
| 76 | + public $vehicle_position_refresh_rate; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Maximum idle time |
|
| 80 | + * @var type integer |
|
| 81 | + */ |
|
| 82 | + public $max_idle_time; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * Syncronized vehicles count |
|
| 86 | + * @var type integer |
|
| 87 | + */ |
|
| 88 | + public $synced_vehicles_count; |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Total vehicles count |
|
| 92 | + * @var type integer |
|
| 93 | + */ |
|
| 94 | + public $total_vehicles_count; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Total addresses count |
|
| 98 | + * @var type integer |
|
| 99 | + */ |
|
| 100 | + public $total_addresses_count; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * The last timestamp the vehicles reloaded |
|
| 104 | + * @var type string |
|
| 105 | + */ |
|
| 106 | + public $last_vehicles_reload; |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * The last timestamp the addresses reloaded |
|
| 110 | + * @var type string |
|
| 111 | + */ |
|
| 112 | + public $last_addresses_reload; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The last timestamp the postions reloaded |
|
| 116 | + * @var type string |
|
| 117 | + */ |
|
| 118 | + public $last_position_reload; |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Metadata, custom key-value storage. |
|
| 122 | + * @var type array |
|
| 123 | + */ |
|
| 124 | + public $metadata = []; |
|
| 125 | 125 | } |
@@ -10,83 +10,83 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class ConnectionParameters extends Common |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Telemetics connection type |
|
| 15 | - * @var type string |
|
| 16 | - */ |
|
| 17 | - public $vendor; |
|
| 13 | + /** |
|
| 14 | + * Telemetics connection type |
|
| 15 | + * @var type string |
|
| 16 | + */ |
|
| 17 | + public $vendor; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Telemetics connection type ID |
|
| 21 | - * @var type integer |
|
| 22 | - */ |
|
| 23 | - public $vendor_id; |
|
| 19 | + /** |
|
| 20 | + * Telemetics connection type ID |
|
| 21 | + * @var type integer |
|
| 22 | + */ |
|
| 23 | + public $vendor_id; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Telemetics connection name |
|
| 27 | - * Required for telematics connection registration. |
|
| 28 | - * @var type string |
|
| 29 | - */ |
|
| 30 | - public $name; |
|
| 25 | + /** |
|
| 26 | + * Telemetics connection name |
|
| 27 | + * Required for telematics connection registration. |
|
| 28 | + * @var type string |
|
| 29 | + */ |
|
| 30 | + public $name; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Telematics connection access host. |
|
| 34 | - * @var type string |
|
| 35 | - */ |
|
| 36 | - public $host; |
|
| 32 | + /** |
|
| 33 | + * Telematics connection access host. |
|
| 34 | + * @var type string |
|
| 35 | + */ |
|
| 36 | + public $host; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Telematics connection access api_key. |
|
| 40 | - * @var type string |
|
| 41 | - */ |
|
| 42 | - public $api_key; |
|
| 38 | + /** |
|
| 39 | + * Telematics connection access api_key. |
|
| 40 | + * @var type string |
|
| 41 | + */ |
|
| 42 | + public $api_key; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Telematics connection access account_id. |
|
| 46 | - * @var type string |
|
| 47 | - */ |
|
| 48 | - public $account_id; |
|
| 44 | + /** |
|
| 45 | + * Telematics connection access account_id. |
|
| 46 | + * @var type string |
|
| 47 | + */ |
|
| 48 | + public $account_id; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Telematics connection access username |
|
| 52 | - * @var type string |
|
| 53 | - */ |
|
| 54 | - public $username; |
|
| 50 | + /** |
|
| 51 | + * Telematics connection access username |
|
| 52 | + * @var type string |
|
| 53 | + */ |
|
| 54 | + public $username; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Telematics connection access password. |
|
| 58 | - * @var type string |
|
| 59 | - */ |
|
| 60 | - public $password; |
|
| 56 | + /** |
|
| 57 | + * Telematics connection access password. |
|
| 58 | + * @var type string |
|
| 59 | + */ |
|
| 60 | + public $password; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Vehicle tracking interval in seconds (default value 60). |
|
| 64 | - * @var type integer |
|
| 65 | - */ |
|
| 66 | - public $vehicle_position_refresh_rate; |
|
| 62 | + /** |
|
| 63 | + * Vehicle tracking interval in seconds (default value 60). |
|
| 64 | + * @var type integer |
|
| 65 | + */ |
|
| 66 | + public $vehicle_position_refresh_rate; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Validate connections credentials. |
|
| 70 | - * @var type Boolean |
|
| 71 | - */ |
|
| 72 | - public $validate_remote_credentials; |
|
| 68 | + /** |
|
| 69 | + * Validate connections credentials. |
|
| 70 | + * @var type Boolean |
|
| 71 | + */ |
|
| 72 | + public $validate_remote_credentials; |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Disable/enable vehicle tracking. |
|
| 76 | - * @var type Boolean |
|
| 77 | - */ |
|
| 78 | - public $is_enabled; |
|
| 74 | + /** |
|
| 75 | + * Disable/enable vehicle tracking. |
|
| 76 | + * @var type Boolean |
|
| 77 | + */ |
|
| 78 | + public $is_enabled; |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Metadata |
|
| 82 | - * @var type string |
|
| 83 | - */ |
|
| 84 | - public $metadata; |
|
| 80 | + /** |
|
| 81 | + * Metadata |
|
| 82 | + * @var type string |
|
| 83 | + */ |
|
| 84 | + public $metadata; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Telematics connection access token. |
|
| 88 | - * Required to show specified connection. |
|
| 89 | - * @var type string |
|
| 90 | - */ |
|
| 91 | - public $connection_token; |
|
| 86 | + /** |
|
| 87 | + * Telematics connection access token. |
|
| 88 | + * Required to show specified connection. |
|
| 89 | + * @var type string |
|
| 90 | + */ |
|
| 91 | + public $connection_token; |
|
| 92 | 92 | } |