@@ -17,12 +17,12 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
20 | + $ab = new AddressBook(); |
|
21 | 21 | |
22 | - $addressIds = [96121941, 96122542, 96100576]; |
|
23 | - $res = $ab->getAddressesByIds($addressIds); |
|
24 | - print_r($res); |
|
22 | + $addressIds = [96121941, 96122542, 96100576]; |
|
23 | + $res = $ab->getAddressesByIds($addressIds); |
|
24 | + print_r($res); |
|
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode() . PHP_EOL; |
|
27 | + echo $e->getMessage() . PHP_EOL; |
|
28 | 28 | } |
@@ -23,6 +23,6 @@ |
||
23 | 23 | $res = $ab->getAddressesByIds($addressIds); |
24 | 24 | print_r($res); |
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode().PHP_EOL; |
|
27 | + echo $e->getMessage().PHP_EOL; |
|
28 | 28 | } |
@@ -16,40 +16,40 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
20 | - |
|
21 | - ///////////////////////////////////////////// |
|
22 | - // get the clusters with precision 1 |
|
23 | - $options = [ |
|
24 | - 'clustering' => [ |
|
25 | - 'precision' => 1 |
|
26 | - ] |
|
27 | - ]; |
|
28 | - $res = $ab->getAddressClustersByBodyPayload($options); |
|
29 | - print_r($res); |
|
30 | - |
|
31 | - ///////////////////////////////////////////// |
|
32 | - // get the clusters with precision 2 from selected area |
|
33 | - $options = [ |
|
34 | - 'clustering' => [ |
|
35 | - 'precision' => 2 |
|
36 | - ], |
|
37 | - 'filter' => [ |
|
38 | - 'selected_areas' => [[ |
|
39 | - 'type' => 'circle', |
|
40 | - 'value' => [ |
|
41 | - 'center' => [ |
|
42 | - 'lat' => 52.4025, |
|
43 | - 'lng' => 4.5601 |
|
44 | - ], |
|
45 | - 'distance' => 10000 |
|
46 | - ] |
|
47 | - ]] |
|
48 | - ] |
|
49 | - ]; |
|
50 | - $res = $ab->getAddressClustersByBodyPayload($options); |
|
51 | - print_r($res); |
|
19 | + $ab = new AddressBook(); |
|
20 | + |
|
21 | + ///////////////////////////////////////////// |
|
22 | + // get the clusters with precision 1 |
|
23 | + $options = [ |
|
24 | + 'clustering' => [ |
|
25 | + 'precision' => 1 |
|
26 | + ] |
|
27 | + ]; |
|
28 | + $res = $ab->getAddressClustersByBodyPayload($options); |
|
29 | + print_r($res); |
|
30 | + |
|
31 | + ///////////////////////////////////////////// |
|
32 | + // get the clusters with precision 2 from selected area |
|
33 | + $options = [ |
|
34 | + 'clustering' => [ |
|
35 | + 'precision' => 2 |
|
36 | + ], |
|
37 | + 'filter' => [ |
|
38 | + 'selected_areas' => [[ |
|
39 | + 'type' => 'circle', |
|
40 | + 'value' => [ |
|
41 | + 'center' => [ |
|
42 | + 'lat' => 52.4025, |
|
43 | + 'lng' => 4.5601 |
|
44 | + ], |
|
45 | + 'distance' => 10000 |
|
46 | + ] |
|
47 | + ]] |
|
48 | + ] |
|
49 | + ]; |
|
50 | + $res = $ab->getAddressClustersByBodyPayload($options); |
|
51 | + print_r($res); |
|
52 | 52 | } catch (ApiError $e) { |
53 | - echo $e->getCode() . PHP_EOL; |
|
54 | - echo $e->getMessage() . PHP_EOL; |
|
53 | + echo $e->getCode() . PHP_EOL; |
|
54 | + echo $e->getMessage() . PHP_EOL; |
|
55 | 55 | } |
@@ -50,6 +50,6 @@ |
||
50 | 50 | $res = $ab->getAddressClustersByBodyPayload($options); |
51 | 51 | print_r($res); |
52 | 52 | } catch (ApiError $e) { |
53 | - echo $e->getCode() . PHP_EOL; |
|
54 | - echo $e->getMessage() . PHP_EOL; |
|
53 | + echo $e->getCode().PHP_EOL; |
|
54 | + echo $e->getMessage().PHP_EOL; |
|
55 | 55 | } |
@@ -17,17 +17,17 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
20 | + $ab = new AddressBook(); |
|
21 | 21 | |
22 | - ///////////////////////////////////////////// |
|
23 | - // get the clusters of unrouted addresses that match quere 'France' |
|
24 | - $options = [ |
|
25 | - 'display' => 'unrouted', |
|
26 | - 'query' => 'France' |
|
27 | - ]; |
|
28 | - $res = $ab->getAddressClusters($options); |
|
29 | - print_r($res); |
|
22 | + ///////////////////////////////////////////// |
|
23 | + // get the clusters of unrouted addresses that match quere 'France' |
|
24 | + $options = [ |
|
25 | + 'display' => 'unrouted', |
|
26 | + 'query' => 'France' |
|
27 | + ]; |
|
28 | + $res = $ab->getAddressClusters($options); |
|
29 | + print_r($res); |
|
30 | 30 | } catch (ApiError $e) { |
31 | - echo $e->getCode() . PHP_EOL; |
|
32 | - echo $e->getMessage() . PHP_EOL; |
|
31 | + echo $e->getCode() . PHP_EOL; |
|
32 | + echo $e->getMessage() . PHP_EOL; |
|
33 | 33 | } |
@@ -28,6 +28,6 @@ |
||
28 | 28 | $res = $ab->getAddressClusters($options); |
29 | 29 | print_r($res); |
30 | 30 | } catch (ApiError $e) { |
31 | - echo $e->getCode() . PHP_EOL; |
|
32 | - echo $e->getMessage() . PHP_EOL; |
|
31 | + echo $e->getCode().PHP_EOL; |
|
32 | + echo $e->getMessage().PHP_EOL; |
|
33 | 33 | } |
@@ -4,123 +4,123 @@ |
||
4 | 4 | |
5 | 5 | class Endpoint |
6 | 6 | { |
7 | - const API_VERSION = "5"; |
|
7 | + const API_VERSION = "5"; |
|
8 | 8 | |
9 | - const MAIN_HOST = "https://wh.route4me.com/modules/api/v5.0"; |
|
9 | + const MAIN_HOST = "https://wh.route4me.com/modules/api/v5.0"; |
|
10 | 10 | |
11 | - const MAIN_HOST_WEB = "https://wh.route4me.com/modules/webapi/v5.0"; |
|
11 | + const MAIN_HOST_WEB = "https://wh.route4me.com/modules/webapi/v5.0"; |
|
12 | 12 | |
13 | - // <editor-fold defaultstate="collapsed" desc="region Routes"> |
|
13 | + // <editor-fold defaultstate="collapsed" desc="region Routes"> |
|
14 | 14 | |
15 | - const Routes = self::MAIN_HOST . "/routes"; |
|
16 | - const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
17 | - const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
18 | - const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
19 | - const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
20 | - const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
21 | - const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
22 | - const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
23 | - const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
24 | - const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
25 | - const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
15 | + const Routes = self::MAIN_HOST . "/routes"; |
|
16 | + const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
17 | + const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
18 | + const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
19 | + const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
20 | + const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
21 | + const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
22 | + const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
23 | + const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
24 | + const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
25 | + const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
26 | 26 | |
27 | - // </editor-fold> |
|
27 | + // </editor-fold> |
|
28 | 28 | |
29 | - // <editor-fold defaultstate="collapsed" desc="Team Users"> |
|
29 | + // <editor-fold defaultstate="collapsed" desc="Team Users"> |
|
30 | 30 | |
31 | - const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
32 | - const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
33 | - const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
31 | + const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
32 | + const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
33 | + const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
34 | 34 | |
35 | - // </editor-fold> |
|
35 | + // </editor-fold> |
|
36 | 36 | |
37 | - const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
38 | - |
|
39 | - // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
|
40 | - |
|
41 | - const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
42 | - const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
43 | - const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
44 | - const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
45 | - const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
46 | - const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
47 | - const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
48 | - |
|
49 | - const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
50 | - const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
51 | - const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
52 | - const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
53 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
|
54 | - self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
55 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
56 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
57 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
|
58 | - self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
59 | - const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
60 | - |
|
61 | - // </editor-fold> |
|
37 | + const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
38 | + |
|
39 | + // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
|
40 | + |
|
41 | + const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
42 | + const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
43 | + const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
44 | + const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
45 | + const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
46 | + const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
47 | + const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
48 | + |
|
49 | + const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
50 | + const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
51 | + const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
52 | + const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
53 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
|
54 | + self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
55 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
56 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
57 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
|
58 | + self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
59 | + const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
60 | + |
|
61 | + // </editor-fold> |
|
62 | 62 | |
63 | - // <editor-fold defaultstate="collapsed" desc="Telematicx Platform"> |
|
63 | + // <editor-fold defaultstate="collapsed" desc="Telematicx Platform"> |
|
64 | 64 | |
65 | - const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
|
65 | + const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
|
66 | 66 | |
67 | - const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
|
68 | - const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
67 | + const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
|
68 | + const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
69 | 69 | |
70 | - const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
71 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
72 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
70 | + const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
71 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
72 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
73 | 73 | |
74 | - const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
75 | - const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
76 | - const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
74 | + const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
75 | + const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
76 | + const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
77 | 77 | |
78 | - const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
79 | - const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
80 | - const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
81 | - const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
78 | + const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
79 | + const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
80 | + const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
81 | + const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
82 | 82 | |
83 | - const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
83 | + const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
84 | 84 | |
85 | - const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
85 | + const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
86 | 86 | |
87 | - const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
88 | - const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
89 | - const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
87 | + const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
88 | + const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
89 | + const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
90 | 90 | |
91 | - const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
92 | - const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
93 | - const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
94 | - const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
91 | + const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
92 | + const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
93 | + const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
94 | + const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
95 | 95 | |
96 | - const TELEMATICS_MEMBER = self::STAGING_HOST; |
|
96 | + const TELEMATICS_MEMBER = self::STAGING_HOST; |
|
97 | 97 | |
98 | - const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
98 | + const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
99 | 99 | |
100 | - const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
101 | - const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
102 | - const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
100 | + const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
101 | + const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
102 | + const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
103 | 103 | |
104 | - const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
105 | - const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
104 | + const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
105 | + const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
106 | 106 | |
107 | - // </editor-fold> |
|
108 | - |
|
109 | - const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
110 | - const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
111 | - const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
112 | - const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
113 | - const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
114 | - const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
115 | - const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
116 | - const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
117 | - const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
118 | - const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
119 | - const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
120 | - const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
121 | - const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
122 | - const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
123 | - const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
124 | - const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
125 | - const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
107 | + // </editor-fold> |
|
108 | + |
|
109 | + const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
110 | + const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
111 | + const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
112 | + const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
113 | + const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
114 | + const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
115 | + const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
116 | + const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
117 | + const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
118 | + const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
119 | + const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
120 | + const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
121 | + const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
122 | + const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
123 | + const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
124 | + const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
125 | + const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
126 | 126 | } |
@@ -12,51 +12,51 @@ discard block |
||
12 | 12 | |
13 | 13 | // <editor-fold defaultstate="collapsed" desc="region Routes"> |
14 | 14 | |
15 | - const Routes = self::MAIN_HOST . "/routes"; |
|
16 | - const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
17 | - const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
18 | - const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
19 | - const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
20 | - const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
21 | - const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
22 | - const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
23 | - const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
24 | - const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
25 | - const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
15 | + const Routes = self::MAIN_HOST."/routes"; |
|
16 | + const RoutesDuplicate = self::MAIN_HOST."/routes/duplicate"; |
|
17 | + const RoutesMerge = self::MAIN_HOST."/routes/merge"; |
|
18 | + const RoutesPaginate = self::MAIN_HOST."/routes/paginate"; |
|
19 | + const RoutesFallbackPaginate = self::MAIN_HOST."/routes/fallback/paginate"; |
|
20 | + const RoutesFallbackDatatable = self::MAIN_HOST."/routes/fallback/datatable"; |
|
21 | + const RoutesFallback = self::MAIN_HOST."/routes/fallback"; |
|
22 | + const RoutesReindexCallback = self::MAIN_HOST."/routes/reindex-callback"; |
|
23 | + const RoutesDatatable = self::MAIN_HOST."/routes/datatable"; |
|
24 | + const RoutesDatatableConfig = self::MAIN_HOST."/routes/datatable/config"; |
|
25 | + const RoutesDatatableConfigFallback = self::MAIN_HOST."/routes/fallback/datatable/config"; |
|
26 | 26 | |
27 | 27 | // </editor-fold> |
28 | 28 | |
29 | 29 | // <editor-fold defaultstate="collapsed" desc="Team Users"> |
30 | 30 | |
31 | - const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
32 | - const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
33 | - const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
31 | + const TEAM_USERS = self::MAIN_HOST."/team/users"; |
|
32 | + const TEAM_USERS_BULK_INSERT = self::MAIN_HOST."/team/bulk-insert"; |
|
33 | + const DriverReview = self::MAIN_HOST."/driver-reviews"; |
|
34 | 34 | |
35 | 35 | // </editor-fold> |
36 | 36 | |
37 | - const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
37 | + const ACCOUNT_PROFILE = self::MAIN_HOST."/profile-api"; |
|
38 | 38 | |
39 | 39 | // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
40 | 40 | |
41 | - const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
42 | - const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
43 | - const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
44 | - const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
45 | - const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
46 | - const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
47 | - const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
48 | - |
|
49 | - const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
50 | - const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
51 | - const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
52 | - const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
41 | + const Vehicles = self::MAIN_HOST."/vehicles"; |
|
42 | + const VehicleTemporary = self::MAIN_HOST."/vehicles/assign"; |
|
43 | + const VehicleExecuteOrder = self::MAIN_HOST."/vehicles/execute"; |
|
44 | + const VehicleLocation = self::MAIN_HOST."/vehicles/location"; |
|
45 | + const VehicleProfiles = self::MAIN_HOST."/vehicle-profiles"; |
|
46 | + const VehicleLicense = self::MAIN_HOST."/vehicles/license"; |
|
47 | + const VehicleSearch = self::MAIN_HOST."/vehicles/search"; |
|
48 | + |
|
49 | + const RECURRING_ROUTES = self::MAIN_HOST."/recurring-routes"; |
|
50 | + const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST."/recurring-routes/schedules"; |
|
51 | + const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST."/recurring-routes/schedules/pagination"; |
|
52 | + const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST."/recurring-routes/route-schedules"; |
|
53 | 53 | const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
54 | - self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
55 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
56 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
54 | + self::MAIN_HOST."/recurring-routes/route-schedules/pagination"; |
|
55 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST."/recurring-routes/route-schedules/replace"; |
|
56 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST."/recurring-routes/scheduled-routes/is-copy"; |
|
57 | 57 | const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
58 | - self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
59 | - const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
58 | + self::MAIN_HOST."/recurring-routes/scheduled-routes/get-copies"; |
|
59 | + const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST."/recurring-routes/master-routes"; |
|
60 | 60 | |
61 | 61 | // </editor-fold> |
62 | 62 | |
@@ -65,62 +65,62 @@ discard block |
||
65 | 65 | const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
66 | 66 | |
67 | 67 | const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
68 | - const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
68 | + const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST."/connections/{connection_token}/vehicles"; |
|
69 | 69 | |
70 | - const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
71 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
72 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
70 | + const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST."/access-tokens"; |
|
71 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST."/access-token-schedules"; |
|
72 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST."/access-token-schedules/{schedule_id}/items"; |
|
73 | 73 | |
74 | - const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
75 | - const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
76 | - const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
74 | + const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST."/vehicle-groups"; |
|
75 | + const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST."/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
76 | + const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST."/vehicles/{vehicle_id}/{relation}"; |
|
77 | 77 | |
78 | - const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
79 | - const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
80 | - const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
81 | - const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
78 | + const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST."/info/members"; |
|
79 | + const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST."/info/vehicles"; |
|
80 | + const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST."/info/vehicle/{vehicle_id}/track"; |
|
81 | + const TELEMATICS_INFO_MODULES = self::STAGING_HOST."/info/members"; |
|
82 | 82 | |
83 | - const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
83 | + const TELEMATICS_ADDRESSES = self::STAGING_HOST."/addresses"; |
|
84 | 84 | |
85 | - const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
85 | + const TELEMATICS_Errors = self::STAGING_HOST."/errors"; |
|
86 | 86 | |
87 | - const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
88 | - const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
89 | - const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
87 | + const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST."/customers/{customer_id}/notifications"; |
|
88 | + const TELEMATICS_CUSTOMERS = self::STAGING_HOST."/customers"; |
|
89 | + const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST."/customers/{customer_id}"; |
|
90 | 90 | |
91 | - const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
92 | - const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
93 | - const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
94 | - const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
91 | + const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST."/notification-schedules/{notification_schedule_id}/items"; |
|
92 | + const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST."/notification-schedules"; |
|
93 | + const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST."/notification-schedules/{schedule_id}"; |
|
94 | + const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST."/one-time-notifications"; |
|
95 | 95 | |
96 | 96 | const TELEMATICS_MEMBER = self::STAGING_HOST; |
97 | 97 | |
98 | - const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
98 | + const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST."/user-activated-modules"; |
|
99 | 99 | |
100 | - const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
101 | - const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
102 | - const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
100 | + const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST."/user-activated-modules/{module_id}"; |
|
101 | + const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST."/user-activated-modules/{module_id}/vehicles"; |
|
102 | + const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST."/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
103 | 103 | |
104 | - const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
105 | - const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
104 | + const TELEMATICS_VENDORS = self::STAGING_HOST."/vendors"; |
|
105 | + const TELEMATICS_VENDOR_ID = self::STAGING_HOST."/vendors/{vendor_id}"; |
|
106 | 106 | |
107 | 107 | // </editor-fold> |
108 | 108 | |
109 | - const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
110 | - const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
111 | - const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
112 | - const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
113 | - const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
114 | - const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
115 | - const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
116 | - const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
117 | - const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
118 | - const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
119 | - const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
120 | - const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
121 | - const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
122 | - const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
123 | - const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
124 | - const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
125 | - const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
109 | + const ADDRESSES = self::MAIN_HOST."/address-book/addresses"; |
|
110 | + const ADDRESSES_BATCH_CREATE = self::MAIN_HOST."/address-book/addresses/batch-create"; |
|
111 | + const ADDRESSES_INDEX_ALL = self::MAIN_HOST."/address-book/addresses/index/all"; |
|
112 | + const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST."/address-book/addresses/index/pagination"; |
|
113 | + const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST."/address-book/addresses/index/clustering"; |
|
114 | + const ADDRESSES_SHOW = self::MAIN_HOST."/address-book/addresses/show"; |
|
115 | + const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST."/address-book/addresses/batch-update"; |
|
116 | + const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST."/address-book/addresses/update-by-areas"; |
|
117 | + const ADDRESSES_DELETE = self::MAIN_HOST."/address-book/addresses/delete"; |
|
118 | + const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST."/address-book/addresses/delete-by-areas"; |
|
119 | + const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST."/address-book/addresses/custom-fields"; |
|
120 | + const ADDRESSES_DEPOTS = self::MAIN_HOST."/address-book/addresses/depots"; |
|
121 | + const ADDRESSES_EXPORT = self::MAIN_HOST."/address-book/addresses/export"; |
|
122 | + const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST."/address-book/addresses/export-by-areas"; |
|
123 | + const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST."/address-book/addresses/export-by-area-ids"; |
|
124 | + const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST."/address-book/addresses/job-tracker/status"; |
|
125 | + const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST."/address-book/addresses/job-tracker/result"; |
|
126 | 126 | } |
@@ -13,39 +13,39 @@ |
||
13 | 13 | */ |
14 | 14 | class AssignedTo extends Common |
15 | 15 | { |
16 | - /** |
|
17 | - * A member the address assigned to. |
|
18 | - * @example 2 |
|
19 | - */ |
|
20 | - public ?int $member_id = null; |
|
21 | - |
|
22 | - /** |
|
23 | - * Member first name. |
|
24 | - * @example 'John' |
|
25 | - */ |
|
26 | - public ?string $member_first_name = null; |
|
27 | - |
|
28 | - /** |
|
29 | - * Member last name. |
|
30 | - * @example 'Doe' |
|
31 | - */ |
|
32 | - public ?string $member_last_name = null; |
|
33 | - |
|
34 | - /** |
|
35 | - * Member email. |
|
36 | - */ |
|
37 | - public ?string $member_email = null; |
|
38 | - |
|
39 | - /** |
|
40 | - * The assignment is valid until to. |
|
41 | - * @example '2019-12-23T09:31:38+00:00' |
|
42 | - */ |
|
43 | - public ?string $until = null; |
|
44 | - |
|
45 | - public function __construct(?array $params = null) |
|
46 | - { |
|
47 | - if ($params !== null) { |
|
48 | - $this->fillFromArray($params); |
|
49 | - } |
|
50 | - } |
|
16 | + /** |
|
17 | + * A member the address assigned to. |
|
18 | + * @example 2 |
|
19 | + */ |
|
20 | + public ?int $member_id = null; |
|
21 | + |
|
22 | + /** |
|
23 | + * Member first name. |
|
24 | + * @example 'John' |
|
25 | + */ |
|
26 | + public ?string $member_first_name = null; |
|
27 | + |
|
28 | + /** |
|
29 | + * Member last name. |
|
30 | + * @example 'Doe' |
|
31 | + */ |
|
32 | + public ?string $member_last_name = null; |
|
33 | + |
|
34 | + /** |
|
35 | + * Member email. |
|
36 | + */ |
|
37 | + public ?string $member_email = null; |
|
38 | + |
|
39 | + /** |
|
40 | + * The assignment is valid until to. |
|
41 | + * @example '2019-12-23T09:31:38+00:00' |
|
42 | + */ |
|
43 | + public ?string $until = null; |
|
44 | + |
|
45 | + public function __construct(?array $params = null) |
|
46 | + { |
|
47 | + if ($params !== null) { |
|
48 | + $this->fillFromArray($params); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | public function __construct(?array $params = null) |
37 | 37 | { |
38 | - if ($params !== null) { |
|
38 | + if ($params!==null) { |
|
39 | 39 | $this->fillFromArray($params); |
40 | 40 | } |
41 | 41 | } |
@@ -14,11 +14,11 @@ |
||
14 | 14 | */ |
15 | 15 | class UpdateAddress extends ResponseAddress |
16 | 16 | { |
17 | - /** |
|
18 | - * @param int $service_time - The route Address Line 1 or array of Address's values. |
|
19 | - */ |
|
20 | - public function __construct(int $service_time) |
|
21 | - { |
|
22 | - $this->service_time = $service_time; |
|
23 | - } |
|
17 | + /** |
|
18 | + * @param int $service_time - The route Address Line 1 or array of Address's values. |
|
19 | + */ |
|
20 | + public function __construct(int $service_time) |
|
21 | + { |
|
22 | + $this->service_time = $service_time; |
|
23 | + } |
|
24 | 24 | } |
@@ -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'] : 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'] : 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'] : false); |
@@ -14,37 +14,37 @@ |
||
14 | 14 | */ |
15 | 15 | class ResponseClustering extends Common |
16 | 16 | { |
17 | - /** |
|
18 | - * An array of the address clusters. |
|
19 | - * @var Cluster[] |
|
20 | - */ |
|
21 | - public ?array $clusters = null; |
|
17 | + /** |
|
18 | + * An array of the address clusters. |
|
19 | + * @var Cluster[] |
|
20 | + */ |
|
21 | + public ?array $clusters = null; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Total quantity of the address Clusters that match the query. |
|
25 | - * @example 1 |
|
26 | - */ |
|
27 | - public ?int $total = null; |
|
23 | + /** |
|
24 | + * Total quantity of the address Clusters that match the query. |
|
25 | + * @example 1 |
|
26 | + */ |
|
27 | + public ?int $total = null; |
|
28 | 28 | |
29 | - public function __construct(?array $params = null) |
|
30 | - { |
|
31 | - if ($params !== null) { |
|
32 | - foreach ($this as $key => $value) { |
|
33 | - if (isset($params[$key])) { |
|
34 | - if ($key === 'clusters') { |
|
35 | - $this->{$key} = array(); |
|
36 | - foreach ($params[$key] as $clst_key => $clst_value) { |
|
37 | - if (is_array($clst_value)) { |
|
38 | - array_push($this->{$key}, new Cluster($clst_value)); |
|
39 | - } elseif (is_object($clst_value) && $clst_value instanceof Cluster) { |
|
40 | - array_push($this->{$key}, $clst_value); |
|
41 | - } |
|
42 | - } |
|
43 | - } else { |
|
44 | - $this->{$key} = $params[$key]; |
|
45 | - } |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
29 | + public function __construct(?array $params = null) |
|
30 | + { |
|
31 | + if ($params !== null) { |
|
32 | + foreach ($this as $key => $value) { |
|
33 | + if (isset($params[$key])) { |
|
34 | + if ($key === 'clusters') { |
|
35 | + $this->{$key} = array(); |
|
36 | + foreach ($params[$key] as $clst_key => $clst_value) { |
|
37 | + if (is_array($clst_value)) { |
|
38 | + array_push($this->{$key}, new Cluster($clst_value)); |
|
39 | + } elseif (is_object($clst_value) && $clst_value instanceof Cluster) { |
|
40 | + array_push($this->{$key}, $clst_value); |
|
41 | + } |
|
42 | + } |
|
43 | + } else { |
|
44 | + $this->{$key} = $params[$key]; |
|
45 | + } |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | public function __construct(?array $params = null) |
30 | 30 | { |
31 | - if ($params !== null) { |
|
31 | + if ($params!==null) { |
|
32 | 32 | foreach ($this as $key => $value) { |
33 | 33 | if (isset($params[$key])) { |
34 | - if ($key === 'clusters') { |
|
34 | + if ($key==='clusters') { |
|
35 | 35 | $this->{$key} = array(); |
36 | 36 | foreach ($params[$key] as $clst_key => $clst_value) { |
37 | 37 | if (is_array($clst_value)) { |
@@ -15,279 +15,279 @@ |
||
15 | 15 | */ |
16 | 16 | class ResponseAddress extends Common |
17 | 17 | { |
18 | - /** |
|
19 | - * Time when the contact was created. |
|
20 | - * @example 1627120286 |
|
21 | - */ |
|
22 | - public ?int $created_timestamp = null; |
|
23 | - |
|
24 | - /** |
|
25 | - * Unique ID of the address. |
|
26 | - * @example 1 |
|
27 | - */ |
|
28 | - public ?int $address_id = null; |
|
29 | - |
|
30 | - /** |
|
31 | - * A group the contact belongs. |
|
32 | - */ |
|
33 | - public ?string $address_group = null; |
|
34 | - |
|
35 | - /** |
|
36 | - * Address group. |
|
37 | - * @example 'Jenkins Ways' |
|
38 | - */ |
|
39 | - public ?string $address_alias = null; |
|
40 | - |
|
41 | - /** |
|
42 | - * The route Address Line 1. |
|
43 | - * @example '999 Aurelio Summit, Jamirtown, CO 52979-8465' |
|
44 | - */ |
|
45 | - public ?string $address_1 = null; |
|
46 | - |
|
47 | - /** |
|
48 | - * The route Address Line 2 which is not used for geocoding. |
|
49 | - */ |
|
50 | - public ?string $address_2 = null; |
|
51 | - |
|
52 | - /** |
|
53 | - * A member the address assigned to. |
|
54 | - * @example 1 |
|
55 | - */ |
|
56 | - public ?int $member_id = null; |
|
57 | - |
|
58 | - /** |
|
59 | - * The first name of the receiving address. |
|
60 | - * @example 'Keyon' |
|
61 | - */ |
|
62 | - public ?string $first_name = null; |
|
63 | - |
|
64 | - /** |
|
65 | - * The last name of the receiving party. |
|
66 | - * @example 'Will' |
|
67 | - */ |
|
68 | - public ?string $last_name = null; |
|
69 | - |
|
70 | - /** |
|
71 | - * The contact's email. |
|
72 | - */ |
|
73 | - public ?string $address_email = null; |
|
74 | - |
|
75 | - /** |
|
76 | - * The contact's phone number. |
|
77 | - */ |
|
78 | - public ?string $address_phone_number = null; |
|
79 | - |
|
80 | - /** |
|
81 | - * The city the address is located in. |
|
82 | - */ |
|
83 | - public ?string $address_city = null; |
|
84 | - |
|
85 | - /** |
|
86 | - * The state the address is located in. |
|
87 | - * @example '10' |
|
88 | - */ |
|
89 | - public ?string $address_state_id = null; |
|
90 | - |
|
91 | - /** |
|
92 | - * The country the address is located in. |
|
93 | - * @example '223' |
|
94 | - */ |
|
95 | - public ?string $address_country_id = null; |
|
96 | - |
|
97 | - /** |
|
98 | - * The zip code the address is located in. |
|
99 | - */ |
|
100 | - public ?string $address_zip = null; |
|
101 | - |
|
102 | - /** |
|
103 | - * A latitude of the contact's cached position. |
|
104 | - * @example -79.102999 |
|
105 | - */ |
|
106 | - public ?float $cached_lat = null; |
|
107 | - |
|
108 | - /** |
|
109 | - * A longitude of the contact's cached position. |
|
110 | - * @example -162.156663 |
|
111 | - */ |
|
112 | - public ?float $cached_lng = null; |
|
113 | - |
|
114 | - /** |
|
115 | - * A latitude of the contact's curbside. |
|
116 | - * @example -79.102999 |
|
117 | - */ |
|
118 | - public ?float $curbside_lat = null; |
|
119 | - |
|
120 | - /** |
|
121 | - * A longitude of the contact's curbside. |
|
122 | - * @example -162.156663 |
|
123 | - */ |
|
124 | - public ?float $curbside_lng = null; |
|
125 | - |
|
126 | - /** |
|
127 | - * An array of the contact's custom field-value pairs. |
|
128 | - * @example ['custom_data_key' => 'custom_data_value'] |
|
129 | - */ |
|
130 | - public ?array $address_custom_data = null; |
|
131 | - |
|
132 | - /** |
|
133 | - * Array of the trip schedules to a location. |
|
134 | - * @var Schedule[] |
|
135 | - */ |
|
136 | - public ?array $schedule = null; |
|
137 | - |
|
138 | - /** |
|
139 | - * Array of the dates, which should be excluded from a trip schedule to a location. |
|
140 | - * Also can be a date string with the 'YYYY-MM-DD' format. |
|
141 | - * @var string|string[] |
|
142 | - * @example ['2019-12-12'] |
|
143 | - */ |
|
144 | - public $schedule_blacklist = null; |
|
145 | - |
|
146 | - /** |
|
147 | - * Number of the routes containing the contact. |
|
148 | - */ |
|
149 | - public ?int $in_route_count = null; |
|
150 | - |
|
151 | - /** |
|
152 | - * How many times visited the contact. |
|
153 | - */ |
|
154 | - public ?int $visited_count = null; |
|
155 | - |
|
156 | - /** |
|
157 | - * When the contact was last visited. |
|
158 | - */ |
|
159 | - public ?int $last_visited_timestamp = null; |
|
160 | - |
|
161 | - /** |
|
162 | - * When the contact was last routed. |
|
163 | - */ |
|
164 | - public ?int $last_routed_timestamp = null; |
|
165 | - |
|
166 | - /** |
|
167 | - * Start of the contact's local time window. |
|
168 | - */ |
|
169 | - public ?int $local_time_window_start = null; |
|
170 | - |
|
171 | - /** |
|
172 | - * End of the contact's local time window. |
|
173 | - */ |
|
174 | - public ?int $local_time_window_end = null; |
|
175 | - |
|
176 | - /** |
|
177 | - * Start of the contact's second local time window. |
|
178 | - */ |
|
179 | - public ?int $local_time_window_start_2 = null; |
|
180 | - |
|
181 | - /** |
|
182 | - * End of the contact's second local time window. |
|
183 | - */ |
|
184 | - public ?int $local_time_window_end_2 = null; |
|
185 | - |
|
186 | - /** |
|
187 | - * The service time at the contact's address. |
|
188 | - */ |
|
189 | - public ?int $service_time = null; |
|
190 | - |
|
191 | - /** |
|
192 | - * The contact's local timezone. |
|
193 | - */ |
|
194 | - public ?string $local_timezone_string = null; |
|
195 | - |
|
196 | - /** |
|
197 | - * The contact's color on the map. |
|
198 | - * @example '000000' |
|
199 | - */ |
|
200 | - public ?string $color = null; |
|
201 | - |
|
202 | - /** |
|
203 | - * The contact's icon on the map. |
|
204 | - */ |
|
205 | - public ?string $address_icon = null; |
|
206 | - |
|
207 | - /** |
|
208 | - * The contact's stop type. |
|
209 | - * String array, available types: 'DELIVERY', 'PICKUP', |
|
210 | - * 'BREAK', 'MEETUP', 'SERVICE', 'VISIT', 'DRIVEBY' |
|
211 | - */ |
|
212 | - public ?string $address_stop_type = null; |
|
213 | - |
|
214 | - /** |
|
215 | - * The cubic volume of the cargo being delivered or picked up at the address. |
|
216 | - */ |
|
217 | - public ?float $address_cube = null; |
|
218 | - |
|
219 | - /** |
|
220 | - * The item quantity of the cargo being delivered or picked up at the address. |
|
221 | - */ |
|
222 | - public ?float $address_pieces = null; |
|
223 | - |
|
224 | - /** |
|
225 | - * The reference number of the address. |
|
226 | - */ |
|
227 | - public ?string $address_reference_no = null; |
|
228 | - |
|
229 | - /** |
|
230 | - * The total revenue for the address. |
|
231 | - */ |
|
232 | - public ?float $address_revenue = null; |
|
233 | - |
|
234 | - /** |
|
235 | - * Weight of the cargo being delivered or picked up at the address. |
|
236 | - */ |
|
237 | - public ?float $address_weight = null; |
|
238 | - |
|
239 | - /** |
|
240 | - * If present, the priority will sequence addresses in all the optimal routes so that |
|
241 | - * higher priority addresses are general at the beginning of the route sequence. |
|
242 | - * 0 is the highest priority, n has higher priority than n + 1 |
|
243 | - */ |
|
244 | - public ?int $address_priority = null; |
|
245 | - |
|
246 | - /** |
|
247 | - * The customer purchase order for the address. |
|
248 | - */ |
|
249 | - public ?string $address_customer_po = null; |
|
250 | - |
|
251 | - /** |
|
252 | - * If true, the address is eligible to pickup. |
|
253 | - */ |
|
254 | - public ?bool $eligible_pickup = null; |
|
255 | - |
|
256 | - /** |
|
257 | - * If true, the addrss is eligible to depot. |
|
258 | - */ |
|
259 | - public ?bool $eligible_depot = null; |
|
260 | - |
|
261 | - /** |
|
262 | - * If true, the addrss is eligible to depot. |
|
263 | - */ |
|
264 | - public ?AssignedTo $assigned_to = null; |
|
265 | - |
|
266 | - public function __construct(?array $params = null) |
|
267 | - { |
|
268 | - if ($params !== null) { |
|
269 | - foreach ($this as $key => $value) { |
|
270 | - if (isset($params[$key])) { |
|
271 | - if ($key === 'schedule') { |
|
272 | - $this->{$key} = array(); |
|
273 | - foreach ($params[$key] as $si_key => $si_value) { |
|
274 | - if (is_array($si_value)) { |
|
275 | - array_push($this->{$key}, new ScheduleItem($si_value)); |
|
276 | - } elseif (is_object($si_value) && $si_value instanceof ScheduleItem) { |
|
277 | - array_push($this->{$key}, $si_value); |
|
278 | - } |
|
279 | - } |
|
280 | - } elseif ($key === 'assigned_to') { |
|
281 | - if (is_array($params[$key])) { |
|
282 | - $this->{$key} = new AssignedTo($params[$key]); |
|
283 | - } elseif (is_object($params[$key]) && $params[$key] instanceof AssignedTo) { |
|
284 | - $this->{$key} = $params[$key]; |
|
285 | - } |
|
286 | - } else { |
|
287 | - $this->{$key} = $params[$key]; |
|
288 | - } |
|
289 | - } |
|
290 | - } |
|
291 | - } |
|
292 | - } |
|
18 | + /** |
|
19 | + * Time when the contact was created. |
|
20 | + * @example 1627120286 |
|
21 | + */ |
|
22 | + public ?int $created_timestamp = null; |
|
23 | + |
|
24 | + /** |
|
25 | + * Unique ID of the address. |
|
26 | + * @example 1 |
|
27 | + */ |
|
28 | + public ?int $address_id = null; |
|
29 | + |
|
30 | + /** |
|
31 | + * A group the contact belongs. |
|
32 | + */ |
|
33 | + public ?string $address_group = null; |
|
34 | + |
|
35 | + /** |
|
36 | + * Address group. |
|
37 | + * @example 'Jenkins Ways' |
|
38 | + */ |
|
39 | + public ?string $address_alias = null; |
|
40 | + |
|
41 | + /** |
|
42 | + * The route Address Line 1. |
|
43 | + * @example '999 Aurelio Summit, Jamirtown, CO 52979-8465' |
|
44 | + */ |
|
45 | + public ?string $address_1 = null; |
|
46 | + |
|
47 | + /** |
|
48 | + * The route Address Line 2 which is not used for geocoding. |
|
49 | + */ |
|
50 | + public ?string $address_2 = null; |
|
51 | + |
|
52 | + /** |
|
53 | + * A member the address assigned to. |
|
54 | + * @example 1 |
|
55 | + */ |
|
56 | + public ?int $member_id = null; |
|
57 | + |
|
58 | + /** |
|
59 | + * The first name of the receiving address. |
|
60 | + * @example 'Keyon' |
|
61 | + */ |
|
62 | + public ?string $first_name = null; |
|
63 | + |
|
64 | + /** |
|
65 | + * The last name of the receiving party. |
|
66 | + * @example 'Will' |
|
67 | + */ |
|
68 | + public ?string $last_name = null; |
|
69 | + |
|
70 | + /** |
|
71 | + * The contact's email. |
|
72 | + */ |
|
73 | + public ?string $address_email = null; |
|
74 | + |
|
75 | + /** |
|
76 | + * The contact's phone number. |
|
77 | + */ |
|
78 | + public ?string $address_phone_number = null; |
|
79 | + |
|
80 | + /** |
|
81 | + * The city the address is located in. |
|
82 | + */ |
|
83 | + public ?string $address_city = null; |
|
84 | + |
|
85 | + /** |
|
86 | + * The state the address is located in. |
|
87 | + * @example '10' |
|
88 | + */ |
|
89 | + public ?string $address_state_id = null; |
|
90 | + |
|
91 | + /** |
|
92 | + * The country the address is located in. |
|
93 | + * @example '223' |
|
94 | + */ |
|
95 | + public ?string $address_country_id = null; |
|
96 | + |
|
97 | + /** |
|
98 | + * The zip code the address is located in. |
|
99 | + */ |
|
100 | + public ?string $address_zip = null; |
|
101 | + |
|
102 | + /** |
|
103 | + * A latitude of the contact's cached position. |
|
104 | + * @example -79.102999 |
|
105 | + */ |
|
106 | + public ?float $cached_lat = null; |
|
107 | + |
|
108 | + /** |
|
109 | + * A longitude of the contact's cached position. |
|
110 | + * @example -162.156663 |
|
111 | + */ |
|
112 | + public ?float $cached_lng = null; |
|
113 | + |
|
114 | + /** |
|
115 | + * A latitude of the contact's curbside. |
|
116 | + * @example -79.102999 |
|
117 | + */ |
|
118 | + public ?float $curbside_lat = null; |
|
119 | + |
|
120 | + /** |
|
121 | + * A longitude of the contact's curbside. |
|
122 | + * @example -162.156663 |
|
123 | + */ |
|
124 | + public ?float $curbside_lng = null; |
|
125 | + |
|
126 | + /** |
|
127 | + * An array of the contact's custom field-value pairs. |
|
128 | + * @example ['custom_data_key' => 'custom_data_value'] |
|
129 | + */ |
|
130 | + public ?array $address_custom_data = null; |
|
131 | + |
|
132 | + /** |
|
133 | + * Array of the trip schedules to a location. |
|
134 | + * @var Schedule[] |
|
135 | + */ |
|
136 | + public ?array $schedule = null; |
|
137 | + |
|
138 | + /** |
|
139 | + * Array of the dates, which should be excluded from a trip schedule to a location. |
|
140 | + * Also can be a date string with the 'YYYY-MM-DD' format. |
|
141 | + * @var string|string[] |
|
142 | + * @example ['2019-12-12'] |
|
143 | + */ |
|
144 | + public $schedule_blacklist = null; |
|
145 | + |
|
146 | + /** |
|
147 | + * Number of the routes containing the contact. |
|
148 | + */ |
|
149 | + public ?int $in_route_count = null; |
|
150 | + |
|
151 | + /** |
|
152 | + * How many times visited the contact. |
|
153 | + */ |
|
154 | + public ?int $visited_count = null; |
|
155 | + |
|
156 | + /** |
|
157 | + * When the contact was last visited. |
|
158 | + */ |
|
159 | + public ?int $last_visited_timestamp = null; |
|
160 | + |
|
161 | + /** |
|
162 | + * When the contact was last routed. |
|
163 | + */ |
|
164 | + public ?int $last_routed_timestamp = null; |
|
165 | + |
|
166 | + /** |
|
167 | + * Start of the contact's local time window. |
|
168 | + */ |
|
169 | + public ?int $local_time_window_start = null; |
|
170 | + |
|
171 | + /** |
|
172 | + * End of the contact's local time window. |
|
173 | + */ |
|
174 | + public ?int $local_time_window_end = null; |
|
175 | + |
|
176 | + /** |
|
177 | + * Start of the contact's second local time window. |
|
178 | + */ |
|
179 | + public ?int $local_time_window_start_2 = null; |
|
180 | + |
|
181 | + /** |
|
182 | + * End of the contact's second local time window. |
|
183 | + */ |
|
184 | + public ?int $local_time_window_end_2 = null; |
|
185 | + |
|
186 | + /** |
|
187 | + * The service time at the contact's address. |
|
188 | + */ |
|
189 | + public ?int $service_time = null; |
|
190 | + |
|
191 | + /** |
|
192 | + * The contact's local timezone. |
|
193 | + */ |
|
194 | + public ?string $local_timezone_string = null; |
|
195 | + |
|
196 | + /** |
|
197 | + * The contact's color on the map. |
|
198 | + * @example '000000' |
|
199 | + */ |
|
200 | + public ?string $color = null; |
|
201 | + |
|
202 | + /** |
|
203 | + * The contact's icon on the map. |
|
204 | + */ |
|
205 | + public ?string $address_icon = null; |
|
206 | + |
|
207 | + /** |
|
208 | + * The contact's stop type. |
|
209 | + * String array, available types: 'DELIVERY', 'PICKUP', |
|
210 | + * 'BREAK', 'MEETUP', 'SERVICE', 'VISIT', 'DRIVEBY' |
|
211 | + */ |
|
212 | + public ?string $address_stop_type = null; |
|
213 | + |
|
214 | + /** |
|
215 | + * The cubic volume of the cargo being delivered or picked up at the address. |
|
216 | + */ |
|
217 | + public ?float $address_cube = null; |
|
218 | + |
|
219 | + /** |
|
220 | + * The item quantity of the cargo being delivered or picked up at the address. |
|
221 | + */ |
|
222 | + public ?float $address_pieces = null; |
|
223 | + |
|
224 | + /** |
|
225 | + * The reference number of the address. |
|
226 | + */ |
|
227 | + public ?string $address_reference_no = null; |
|
228 | + |
|
229 | + /** |
|
230 | + * The total revenue for the address. |
|
231 | + */ |
|
232 | + public ?float $address_revenue = null; |
|
233 | + |
|
234 | + /** |
|
235 | + * Weight of the cargo being delivered or picked up at the address. |
|
236 | + */ |
|
237 | + public ?float $address_weight = null; |
|
238 | + |
|
239 | + /** |
|
240 | + * If present, the priority will sequence addresses in all the optimal routes so that |
|
241 | + * higher priority addresses are general at the beginning of the route sequence. |
|
242 | + * 0 is the highest priority, n has higher priority than n + 1 |
|
243 | + */ |
|
244 | + public ?int $address_priority = null; |
|
245 | + |
|
246 | + /** |
|
247 | + * The customer purchase order for the address. |
|
248 | + */ |
|
249 | + public ?string $address_customer_po = null; |
|
250 | + |
|
251 | + /** |
|
252 | + * If true, the address is eligible to pickup. |
|
253 | + */ |
|
254 | + public ?bool $eligible_pickup = null; |
|
255 | + |
|
256 | + /** |
|
257 | + * If true, the addrss is eligible to depot. |
|
258 | + */ |
|
259 | + public ?bool $eligible_depot = null; |
|
260 | + |
|
261 | + /** |
|
262 | + * If true, the addrss is eligible to depot. |
|
263 | + */ |
|
264 | + public ?AssignedTo $assigned_to = null; |
|
265 | + |
|
266 | + public function __construct(?array $params = null) |
|
267 | + { |
|
268 | + if ($params !== null) { |
|
269 | + foreach ($this as $key => $value) { |
|
270 | + if (isset($params[$key])) { |
|
271 | + if ($key === 'schedule') { |
|
272 | + $this->{$key} = array(); |
|
273 | + foreach ($params[$key] as $si_key => $si_value) { |
|
274 | + if (is_array($si_value)) { |
|
275 | + array_push($this->{$key}, new ScheduleItem($si_value)); |
|
276 | + } elseif (is_object($si_value) && $si_value instanceof ScheduleItem) { |
|
277 | + array_push($this->{$key}, $si_value); |
|
278 | + } |
|
279 | + } |
|
280 | + } elseif ($key === 'assigned_to') { |
|
281 | + if (is_array($params[$key])) { |
|
282 | + $this->{$key} = new AssignedTo($params[$key]); |
|
283 | + } elseif (is_object($params[$key]) && $params[$key] instanceof AssignedTo) { |
|
284 | + $this->{$key} = $params[$key]; |
|
285 | + } |
|
286 | + } else { |
|
287 | + $this->{$key} = $params[$key]; |
|
288 | + } |
|
289 | + } |
|
290 | + } |
|
291 | + } |
|
292 | + } |
|
293 | 293 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | |
266 | 266 | public function __construct(?array $params = null) |
267 | 267 | { |
268 | - if ($params !== null) { |
|
268 | + if ($params!==null) { |
|
269 | 269 | foreach ($this as $key => $value) { |
270 | 270 | if (isset($params[$key])) { |
271 | - if ($key === 'schedule') { |
|
271 | + if ($key==='schedule') { |
|
272 | 272 | $this->{$key} = array(); |
273 | 273 | foreach ($params[$key] as $si_key => $si_value) { |
274 | 274 | if (is_array($si_value)) { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | array_push($this->{$key}, $si_value); |
278 | 278 | } |
279 | 279 | } |
280 | - } elseif ($key === 'assigned_to') { |
|
280 | + } elseif ($key==='assigned_to') { |
|
281 | 281 | if (is_array($params[$key])) { |
282 | 282 | $this->{$key} = new AssignedTo($params[$key]); |
283 | 283 | } elseif (is_object($params[$key]) && $params[$key] instanceof AssignedTo) { |