@@ -9,149 +9,149 @@ |
||
9 | 9 | */ |
10 | 10 | class RouteParametersQuery extends Common |
11 | 11 | { |
12 | - /** |
|
13 | - * Route unique identifier |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - public $route_id; |
|
17 | - |
|
18 | - /** |
|
19 | - * Pass True to return directions and the route path. |
|
20 | - * @var boolean |
|
21 | - */ |
|
22 | - public $directions; |
|
23 | - |
|
24 | - /** |
|
25 | - * Available values: |
|
26 | - * - 'None' - no path output. |
|
27 | - * - 'Points' - points path output |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $route_path_output; |
|
31 | - |
|
32 | - /** |
|
33 | - * Output route tracking data in response. |
|
34 | - * @var boolean |
|
35 | - */ |
|
36 | - public $device_tracking_history; |
|
37 | - |
|
38 | - /** |
|
39 | - * The number of existing routes that should be returned per response |
|
40 | - * when looking at a list of all the routes. |
|
41 | - * @var integer |
|
42 | - */ |
|
43 | - public $limit; |
|
44 | - |
|
45 | - /** |
|
46 | - * The page number for route listing pagination.<br> |
|
47 | - * Increment the offset by the limit number to move to the next page. |
|
48 | - * @var integer |
|
49 | - */ |
|
50 | - public $offset; |
|
51 | - |
|
52 | - /** |
|
53 | - * Start date to filter |
|
54 | - * @var string |
|
55 | - */ |
|
56 | - public $start_date; |
|
57 | - |
|
58 | - /** |
|
59 | - * End date to filter |
|
60 | - * @var string |
|
61 | - */ |
|
62 | - public $end_date; |
|
63 | - |
|
64 | - /** |
|
65 | - * Output addresses and directions in the original optimization request sequence.<br> |
|
66 | - * This is to allow us to compare routes before & after optimization. |
|
67 | - * @var boolean |
|
68 | - */ |
|
69 | - public $original; |
|
70 | - |
|
71 | - /** |
|
72 | - * Output route and stop-specific notes. The notes will have timestamps, |
|
73 | - * note types, and geospatial information if available. |
|
74 | - * @var boolean |
|
75 | - */ |
|
76 | - public $notes; |
|
77 | - |
|
78 | - /** |
|
79 | - * If true, the order inventory info included in the response. |
|
80 | - * @var boolean |
|
81 | - */ |
|
82 | - public $order_inventory; |
|
83 | - |
|
84 | - /** |
|
85 | - * If true, not visited destinations of an active route re-optimized (re-sequenced). |
|
86 | - * @var boolean |
|
87 | - */ |
|
88 | - public $remaining; |
|
89 | - |
|
90 | - /** |
|
91 | - * Search query |
|
92 | - * @var string |
|
93 | - */ |
|
94 | - public $query; |
|
95 | - |
|
96 | - /** |
|
97 | - * Updating a route supports the reoptimize=1 parameter, |
|
98 | - * which reoptimizes only that route.<br> |
|
99 | - * Also supports the parameters from GET. |
|
100 | - * @var boolean |
|
101 | - */ |
|
102 | - public $reoptimize; |
|
103 | - |
|
104 | - /** |
|
105 | - * Whether disable or not a route optimization.<br> |
|
106 | - * Available values: |
|
107 | - * - true - disable a route optimization; |
|
108 | - * - false - not disable a route optimization. |
|
109 | - * @var boolean |
|
110 | - */ |
|
111 | - public $disable_optimization; |
|
112 | - |
|
113 | - /** |
|
114 | - * The driving directions will be generated biased for this selection. |
|
115 | - * This has no impact on route sequencing.<br> |
|
116 | - * Available values: |
|
117 | - * - 'Distance'; |
|
118 | - * - 'Time'; |
|
119 | - * - 'timeWithTraffic'. |
|
120 | - * @var boolean |
|
121 | - */ |
|
122 | - public $optimize; |
|
123 | - |
|
124 | - /** |
|
125 | - * By sending recompute_directions=1 we request that the route directions |
|
126 | - * be recomputed (note that this does happen automatically if certain properties |
|
127 | - * of the route are updated, such as stop sequence_no changes or round-tripness) |
|
128 | - * @var boolean |
|
129 | - */ |
|
130 | - public $recompute_directions; |
|
131 | - |
|
132 | - /** |
|
133 | - * Response format('json', 'csv', 'xml') |
|
134 | - * @var string |
|
135 | - */ |
|
136 | - public $response_format; |
|
137 | - |
|
138 | - /** |
|
139 | - * Identifier of a route destination. |
|
140 | - * @var integer |
|
141 | - */ |
|
142 | - public $route_destination_id; |
|
143 | - |
|
144 | - /** |
|
145 | - * If true, will be redirected |
|
146 | - * @var boolean |
|
147 | - */ |
|
148 | - public $redirect; |
|
149 | - |
|
150 | - /** |
|
151 | - * If true, the address bundling info is included into route response. |
|
152 | - * @var boolean |
|
153 | - */ |
|
154 | - public $bundling_items; |
|
155 | - |
|
156 | - public $device_type; |
|
12 | + /** |
|
13 | + * Route unique identifier |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + public $route_id; |
|
17 | + |
|
18 | + /** |
|
19 | + * Pass True to return directions and the route path. |
|
20 | + * @var boolean |
|
21 | + */ |
|
22 | + public $directions; |
|
23 | + |
|
24 | + /** |
|
25 | + * Available values: |
|
26 | + * - 'None' - no path output. |
|
27 | + * - 'Points' - points path output |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $route_path_output; |
|
31 | + |
|
32 | + /** |
|
33 | + * Output route tracking data in response. |
|
34 | + * @var boolean |
|
35 | + */ |
|
36 | + public $device_tracking_history; |
|
37 | + |
|
38 | + /** |
|
39 | + * The number of existing routes that should be returned per response |
|
40 | + * when looking at a list of all the routes. |
|
41 | + * @var integer |
|
42 | + */ |
|
43 | + public $limit; |
|
44 | + |
|
45 | + /** |
|
46 | + * The page number for route listing pagination.<br> |
|
47 | + * Increment the offset by the limit number to move to the next page. |
|
48 | + * @var integer |
|
49 | + */ |
|
50 | + public $offset; |
|
51 | + |
|
52 | + /** |
|
53 | + * Start date to filter |
|
54 | + * @var string |
|
55 | + */ |
|
56 | + public $start_date; |
|
57 | + |
|
58 | + /** |
|
59 | + * End date to filter |
|
60 | + * @var string |
|
61 | + */ |
|
62 | + public $end_date; |
|
63 | + |
|
64 | + /** |
|
65 | + * Output addresses and directions in the original optimization request sequence.<br> |
|
66 | + * This is to allow us to compare routes before & after optimization. |
|
67 | + * @var boolean |
|
68 | + */ |
|
69 | + public $original; |
|
70 | + |
|
71 | + /** |
|
72 | + * Output route and stop-specific notes. The notes will have timestamps, |
|
73 | + * note types, and geospatial information if available. |
|
74 | + * @var boolean |
|
75 | + */ |
|
76 | + public $notes; |
|
77 | + |
|
78 | + /** |
|
79 | + * If true, the order inventory info included in the response. |
|
80 | + * @var boolean |
|
81 | + */ |
|
82 | + public $order_inventory; |
|
83 | + |
|
84 | + /** |
|
85 | + * If true, not visited destinations of an active route re-optimized (re-sequenced). |
|
86 | + * @var boolean |
|
87 | + */ |
|
88 | + public $remaining; |
|
89 | + |
|
90 | + /** |
|
91 | + * Search query |
|
92 | + * @var string |
|
93 | + */ |
|
94 | + public $query; |
|
95 | + |
|
96 | + /** |
|
97 | + * Updating a route supports the reoptimize=1 parameter, |
|
98 | + * which reoptimizes only that route.<br> |
|
99 | + * Also supports the parameters from GET. |
|
100 | + * @var boolean |
|
101 | + */ |
|
102 | + public $reoptimize; |
|
103 | + |
|
104 | + /** |
|
105 | + * Whether disable or not a route optimization.<br> |
|
106 | + * Available values: |
|
107 | + * - true - disable a route optimization; |
|
108 | + * - false - not disable a route optimization. |
|
109 | + * @var boolean |
|
110 | + */ |
|
111 | + public $disable_optimization; |
|
112 | + |
|
113 | + /** |
|
114 | + * The driving directions will be generated biased for this selection. |
|
115 | + * This has no impact on route sequencing.<br> |
|
116 | + * Available values: |
|
117 | + * - 'Distance'; |
|
118 | + * - 'Time'; |
|
119 | + * - 'timeWithTraffic'. |
|
120 | + * @var boolean |
|
121 | + */ |
|
122 | + public $optimize; |
|
123 | + |
|
124 | + /** |
|
125 | + * By sending recompute_directions=1 we request that the route directions |
|
126 | + * be recomputed (note that this does happen automatically if certain properties |
|
127 | + * of the route are updated, such as stop sequence_no changes or round-tripness) |
|
128 | + * @var boolean |
|
129 | + */ |
|
130 | + public $recompute_directions; |
|
131 | + |
|
132 | + /** |
|
133 | + * Response format('json', 'csv', 'xml') |
|
134 | + * @var string |
|
135 | + */ |
|
136 | + public $response_format; |
|
137 | + |
|
138 | + /** |
|
139 | + * Identifier of a route destination. |
|
140 | + * @var integer |
|
141 | + */ |
|
142 | + public $route_destination_id; |
|
143 | + |
|
144 | + /** |
|
145 | + * If true, will be redirected |
|
146 | + * @var boolean |
|
147 | + */ |
|
148 | + public $redirect; |
|
149 | + |
|
150 | + /** |
|
151 | + * If true, the address bundling info is included into route response. |
|
152 | + * @var boolean |
|
153 | + */ |
|
154 | + public $bundling_items; |
|
155 | + |
|
156 | + public $device_type; |
|
157 | 157 | } |
@@ -6,79 +6,79 @@ |
||
6 | 6 | |
7 | 7 | class ActivityParameters extends Common |
8 | 8 | { |
9 | - public $route_id; |
|
10 | - public $device_id; |
|
11 | - public $member_id; |
|
12 | - public $team; |
|
13 | - public $limit; |
|
14 | - public $offset; |
|
15 | - public $start; |
|
16 | - public $end; |
|
17 | - public $activity_type; |
|
18 | - public $activity_message; |
|
9 | + public $route_id; |
|
10 | + public $device_id; |
|
11 | + public $member_id; |
|
12 | + public $team; |
|
13 | + public $limit; |
|
14 | + public $offset; |
|
15 | + public $start; |
|
16 | + public $end; |
|
17 | + public $activity_type; |
|
18 | + public $activity_message; |
|
19 | 19 | |
20 | - public $activity_id; |
|
21 | - public $activity_timestamp; |
|
22 | - public $route_destination_id; |
|
23 | - public $note_id; |
|
24 | - public $member; |
|
25 | - public $note_type; |
|
26 | - public $note_contents; |
|
27 | - public $route_name; |
|
28 | - public $note_file; |
|
29 | - public $destination_name; |
|
30 | - public $destination_alias; |
|
20 | + public $activity_id; |
|
21 | + public $activity_timestamp; |
|
22 | + public $route_destination_id; |
|
23 | + public $note_id; |
|
24 | + public $member; |
|
25 | + public $note_type; |
|
26 | + public $note_contents; |
|
27 | + public $route_name; |
|
28 | + public $note_file; |
|
29 | + public $destination_name; |
|
30 | + public $destination_alias; |
|
31 | 31 | |
32 | - public function __construct() |
|
33 | - { |
|
34 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
35 | - } |
|
32 | + public function __construct() |
|
33 | + { |
|
34 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
35 | + } |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | * Get all the activities limited by query parameters. |
39 | 39 | */ |
40 | - public static function getActivities($params) |
|
41 | - { |
|
42 | - $allQueryFields = ['route_id', 'team', 'limit', 'offset', 'start', 'member_id']; |
|
40 | + public static function getActivities($params) |
|
41 | + { |
|
42 | + $allQueryFields = ['route_id', 'team', 'limit', 'offset', 'start', 'member_id']; |
|
43 | 43 | |
44 | - $activity = Route4Me::makeRequst([ |
|
45 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
46 | - 'method' => 'GET', |
|
47 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
48 | - ]); |
|
44 | + $activity = Route4Me::makeRequst([ |
|
45 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
46 | + 'method' => 'GET', |
|
47 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
48 | + ]); |
|
49 | 49 | |
50 | - return $activity; |
|
51 | - } |
|
50 | + return $activity; |
|
51 | + } |
|
52 | 52 | |
53 | - /* |
|
53 | + /* |
|
54 | 54 | * Returns the activity feed. |
55 | 55 | */ |
56 | - public static function searchActivities($params) |
|
57 | - { |
|
58 | - $allQueryFields = ['route_id', 'limit', 'offset', 'activity_type']; |
|
56 | + public static function searchActivities($params) |
|
57 | + { |
|
58 | + $allQueryFields = ['route_id', 'limit', 'offset', 'activity_type']; |
|
59 | 59 | |
60 | - $activity = Route4Me::makeRequst([ |
|
61 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
62 | - 'method' => 'GET', |
|
63 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
64 | - ]); |
|
60 | + $activity = Route4Me::makeRequst([ |
|
61 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
62 | + 'method' => 'GET', |
|
63 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
64 | + ]); |
|
65 | 65 | |
66 | - return $activity; |
|
67 | - } |
|
66 | + return $activity; |
|
67 | + } |
|
68 | 68 | |
69 | - /* |
|
69 | + /* |
|
70 | 70 | * Creates a user's activity by sending a custom message to the activity stream. |
71 | 71 | */ |
72 | - public static function sendUserMessage($params) |
|
73 | - { |
|
74 | - $allBodyFields = ['activity_type', 'activity_message', 'route_id']; |
|
72 | + public static function sendUserMessage($params) |
|
73 | + { |
|
74 | + $allBodyFields = ['activity_type', 'activity_message', 'route_id']; |
|
75 | 75 | |
76 | - $result = Route4Me::makeRequst([ |
|
77 | - 'url' => Endpoint::ACTIVITY_FEED, |
|
78 | - 'method' => 'POST', |
|
79 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | - ]); |
|
76 | + $result = Route4Me::makeRequst([ |
|
77 | + 'url' => Endpoint::ACTIVITY_FEED, |
|
78 | + 'method' => 'POST', |
|
79 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | + ]); |
|
81 | 81 | |
82 | - return $result; |
|
83 | - } |
|
82 | + return $result; |
|
83 | + } |
|
84 | 84 | } |
@@ -7,101 +7,101 @@ |
||
7 | 7 | |
8 | 8 | class Territory extends Common |
9 | 9 | { |
10 | - /** |
|
11 | - * @var |
|
12 | - */ |
|
13 | - public $territory_id; // Territory id |
|
14 | - public $territory_name; |
|
15 | - public $territory_color; |
|
16 | - public $addresses; |
|
17 | - public $member_id; |
|
18 | - public $territory; // Territory parameters |
|
19 | - |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
23 | - } |
|
24 | - |
|
25 | - public static function fromArray(array $params) |
|
26 | - { |
|
27 | - if (!isset($params['territory_name'])) { |
|
28 | - throw new BadParam('Territory name must be provided'); |
|
29 | - } |
|
30 | - |
|
31 | - if (!isset($params['territory_color'])) { |
|
32 | - throw new BadParam('Territory color must be provided'); |
|
33 | - } |
|
34 | - |
|
35 | - if (!isset($params['territory'])) { |
|
36 | - throw new BadParam('Territory must be provided'); |
|
37 | - } |
|
38 | - return parent::fromArray($params); |
|
39 | - } |
|
40 | - |
|
41 | - public static function getTerritory($params) |
|
42 | - { |
|
43 | - $allQueryFields = ['territory_id', 'addresses']; |
|
44 | - |
|
45 | - $territory = Route4Me::makeRequst([ |
|
46 | - 'url' => Endpoint::TERRITORY_V4, |
|
47 | - 'method' => 'GET', |
|
48 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
49 | - ]); |
|
50 | - |
|
51 | - return $territory; |
|
52 | - } |
|
53 | - |
|
54 | - public static function getTerritories($params) |
|
55 | - { |
|
56 | - $allQueryFields = ['offset', 'limit', 'addresses']; |
|
57 | - |
|
58 | - $response = Route4Me::makeRequst([ |
|
59 | - 'url' => Endpoint::TERRITORY_V4, |
|
60 | - 'method' => 'GET', |
|
61 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
62 | - ]); |
|
63 | - |
|
64 | - return $response; |
|
65 | - } |
|
66 | - |
|
67 | - public static function addTerritory($params) |
|
68 | - { |
|
69 | - $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory']; |
|
70 | - |
|
71 | - $response = Route4Me::makeRequst([ |
|
72 | - 'url' => Endpoint::TERRITORY_V4, |
|
73 | - 'method' => 'POST', |
|
74 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
75 | - ]); |
|
76 | - |
|
77 | - return $response; |
|
78 | - } |
|
79 | - |
|
80 | - public function deleteTerritory($territory_id) |
|
81 | - { |
|
82 | - $result = Route4Me::makeRequst([ |
|
83 | - 'url' => Endpoint::TERRITORY_V4, |
|
84 | - 'method' => 'DELETE', |
|
85 | - 'query' => [ |
|
86 | - 'territory_id' => $territory_id, |
|
87 | - ], |
|
88 | - ]); |
|
89 | - |
|
90 | - return $result; |
|
91 | - } |
|
92 | - |
|
93 | - public function updateTerritory($params) |
|
94 | - { |
|
95 | - $allQueryFields = ['territory_id']; |
|
96 | - $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory']; |
|
97 | - |
|
98 | - $response = Route4Me::makeRequst([ |
|
99 | - 'url' => Endpoint::TERRITORY_V4, |
|
100 | - 'method' => 'PUT', |
|
101 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
102 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
103 | - ]); |
|
104 | - |
|
105 | - return $response; |
|
106 | - } |
|
10 | + /** |
|
11 | + * @var |
|
12 | + */ |
|
13 | + public $territory_id; // Territory id |
|
14 | + public $territory_name; |
|
15 | + public $territory_color; |
|
16 | + public $addresses; |
|
17 | + public $member_id; |
|
18 | + public $territory; // Territory parameters |
|
19 | + |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
23 | + } |
|
24 | + |
|
25 | + public static function fromArray(array $params) |
|
26 | + { |
|
27 | + if (!isset($params['territory_name'])) { |
|
28 | + throw new BadParam('Territory name must be provided'); |
|
29 | + } |
|
30 | + |
|
31 | + if (!isset($params['territory_color'])) { |
|
32 | + throw new BadParam('Territory color must be provided'); |
|
33 | + } |
|
34 | + |
|
35 | + if (!isset($params['territory'])) { |
|
36 | + throw new BadParam('Territory must be provided'); |
|
37 | + } |
|
38 | + return parent::fromArray($params); |
|
39 | + } |
|
40 | + |
|
41 | + public static function getTerritory($params) |
|
42 | + { |
|
43 | + $allQueryFields = ['territory_id', 'addresses']; |
|
44 | + |
|
45 | + $territory = Route4Me::makeRequst([ |
|
46 | + 'url' => Endpoint::TERRITORY_V4, |
|
47 | + 'method' => 'GET', |
|
48 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
49 | + ]); |
|
50 | + |
|
51 | + return $territory; |
|
52 | + } |
|
53 | + |
|
54 | + public static function getTerritories($params) |
|
55 | + { |
|
56 | + $allQueryFields = ['offset', 'limit', 'addresses']; |
|
57 | + |
|
58 | + $response = Route4Me::makeRequst([ |
|
59 | + 'url' => Endpoint::TERRITORY_V4, |
|
60 | + 'method' => 'GET', |
|
61 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
62 | + ]); |
|
63 | + |
|
64 | + return $response; |
|
65 | + } |
|
66 | + |
|
67 | + public static function addTerritory($params) |
|
68 | + { |
|
69 | + $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory']; |
|
70 | + |
|
71 | + $response = Route4Me::makeRequst([ |
|
72 | + 'url' => Endpoint::TERRITORY_V4, |
|
73 | + 'method' => 'POST', |
|
74 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
75 | + ]); |
|
76 | + |
|
77 | + return $response; |
|
78 | + } |
|
79 | + |
|
80 | + public function deleteTerritory($territory_id) |
|
81 | + { |
|
82 | + $result = Route4Me::makeRequst([ |
|
83 | + 'url' => Endpoint::TERRITORY_V4, |
|
84 | + 'method' => 'DELETE', |
|
85 | + 'query' => [ |
|
86 | + 'territory_id' => $territory_id, |
|
87 | + ], |
|
88 | + ]); |
|
89 | + |
|
90 | + return $result; |
|
91 | + } |
|
92 | + |
|
93 | + public function updateTerritory($params) |
|
94 | + { |
|
95 | + $allQueryFields = ['territory_id']; |
|
96 | + $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory']; |
|
97 | + |
|
98 | + $response = Route4Me::makeRequst([ |
|
99 | + 'url' => Endpoint::TERRITORY_V4, |
|
100 | + 'method' => 'PUT', |
|
101 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
102 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
103 | + ]); |
|
104 | + |
|
105 | + return $response; |
|
106 | + } |
|
107 | 107 | } |
@@ -11,15 +11,15 @@ |
||
11 | 11 | */ |
12 | 12 | class Direction extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Starting location of a direction |
|
16 | - * @var DirectionLocation |
|
17 | - */ |
|
18 | - public $location = []; |
|
14 | + /** |
|
15 | + * Starting location of a direction |
|
16 | + * @var DirectionLocation |
|
17 | + */ |
|
18 | + public $location = []; |
|
19 | 19 | |
20 | - /** |
|
21 | - * The direction steps |
|
22 | - * @var DirectionStep[] |
|
23 | - */ |
|
24 | - public $steps = []; |
|
20 | + /** |
|
21 | + * The direction steps |
|
22 | + * @var DirectionStep[] |
|
23 | + */ |
|
24 | + public $steps = []; |
|
25 | 25 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class CustomNoteTypeResponse extends Common |
8 | 8 | { |
9 | - /** |
|
10 | - * Note custom type ID |
|
11 | - * @var integer |
|
12 | - */ |
|
13 | - public $note_custom_type_id; |
|
9 | + /** |
|
10 | + * Note custom type ID |
|
11 | + * @var integer |
|
12 | + */ |
|
13 | + public $note_custom_type_id; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Note custom type |
|
17 | - * @var CustomNoteType |
|
18 | - */ |
|
19 | - public $note_custom_type; |
|
15 | + /** |
|
16 | + * Note custom type |
|
17 | + * @var CustomNoteType |
|
18 | + */ |
|
19 | + public $note_custom_type; |
|
20 | 20 | |
21 | - /** |
|
22 | - * ID of a root owner of the account |
|
23 | - * @var integer |
|
24 | - */ |
|
25 | - public $root_owner_member_id; |
|
21 | + /** |
|
22 | + * ID of a root owner of the account |
|
23 | + * @var integer |
|
24 | + */ |
|
25 | + public $root_owner_member_id; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Values of the custom note type |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - public $note_custom_type_values=[]; |
|
27 | + /** |
|
28 | + * Values of the custom note type |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + public $note_custom_type_values=[]; |
|
32 | 32 | } |
@@ -6,144 +6,144 @@ |
||
6 | 6 | |
7 | 7 | class AddressBookGroup extends Common |
8 | 8 | { |
9 | - public $group_id; |
|
10 | - public $group_name; |
|
11 | - public $group_color; |
|
12 | - public $group_icon; |
|
13 | - public $member_id; |
|
14 | - public $filter; |
|
15 | - |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | - } |
|
20 | - |
|
21 | - public static function getAddressBookGroup(array $params) |
|
22 | - { |
|
23 | - $abGroup = Route4Me::makeRequst([ |
|
24 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
25 | - 'method' => 'GET', |
|
26 | - 'query' => [ |
|
27 | - 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
28 | - ], |
|
29 | - ]); |
|
30 | - |
|
31 | - return $abGroup; |
|
32 | - } |
|
33 | - |
|
34 | - public static function updateAddressBookGroup(array $params) |
|
35 | - { |
|
36 | - $allBodyFields = ['group_id', 'group_color', 'group_icon', 'filter']; |
|
37 | - |
|
38 | - $abGroup = Route4Me::makeRequst([ |
|
39 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
40 | - 'method' => 'PUT', |
|
41 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
42 | - ]); |
|
43 | - |
|
44 | - return $abGroup; |
|
45 | - } |
|
46 | - |
|
47 | - public static function removeAddressBookGroup(array $params) |
|
48 | - { |
|
49 | - $allBodyFields = ['group_id']; |
|
50 | - |
|
51 | - $abGroup = Route4Me::makeRequst([ |
|
52 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
53 | - 'method' => 'DELETE', |
|
54 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
55 | - ]); |
|
56 | - |
|
57 | - return $abGroup; |
|
58 | - } |
|
59 | - |
|
60 | - public static function createAddressBookGroup(array $params) |
|
61 | - { |
|
62 | - $allBodyFields = ['group_name', 'group_color', 'group_icon', 'filter']; |
|
63 | - |
|
64 | - $abGroup = Route4Me::makeRequst([ |
|
65 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
66 | - 'method' => 'POST', |
|
67 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
68 | - ]); |
|
69 | - |
|
70 | - return $abGroup; |
|
71 | - } |
|
72 | - |
|
73 | - public static function searchAddressBookGroups(array $params) |
|
74 | - { |
|
75 | - $allBodyFields = ['fields', 'offset', 'limit', 'filter']; |
|
76 | - |
|
77 | - $abGroups = Route4Me::makeRequst([ |
|
78 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
79 | - 'method' => 'POST', |
|
80 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
81 | - ]); |
|
82 | - |
|
83 | - return $abGroups; |
|
84 | - } |
|
85 | - |
|
86 | - public static function getAddressBookContactsByGroup(array $params) |
|
87 | - { |
|
88 | - $allBodyFields = ['fields', 'group_id']; |
|
89 | - |
|
90 | - $abGroups = Route4Me::makeRequst([ |
|
91 | - 'url' => Endpoint::ADDRESS_BOOK_SEARCH, |
|
92 | - 'method' => 'POST', |
|
93 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
94 | - ]); |
|
95 | - |
|
96 | - return $abGroups; |
|
97 | - } |
|
98 | - |
|
99 | - public static function getAddressBookGroups(array $params) |
|
100 | - { |
|
101 | - $abGroup = Route4Me::makeRequst([ |
|
102 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
103 | - 'method' => 'GET', |
|
104 | - 'query' => [ |
|
105 | - 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
106 | - 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
107 | - ], |
|
108 | - ]); |
|
109 | - |
|
110 | - return $abGroup; |
|
111 | - } |
|
112 | - |
|
113 | - public static function getRandomAddressBookGroup(array $params) |
|
114 | - { |
|
115 | - $abGroups = self::getAddressBookGroups($params); |
|
116 | - |
|
117 | - if (isset($abGroups) && sizeof($abGroups) > 1) { |
|
118 | - $groupsSize = sizeof($abGroups); |
|
119 | - |
|
120 | - $randomGroupIndex = rand(0, $groupsSize - 1); |
|
121 | - |
|
122 | - return $abGroups[$randomGroupIndex]; |
|
123 | - } |
|
124 | - |
|
125 | - return null; |
|
126 | - } |
|
127 | - |
|
128 | - /* |
|
9 | + public $group_id; |
|
10 | + public $group_name; |
|
11 | + public $group_color; |
|
12 | + public $group_icon; |
|
13 | + public $member_id; |
|
14 | + public $filter; |
|
15 | + |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | + } |
|
20 | + |
|
21 | + public static function getAddressBookGroup(array $params) |
|
22 | + { |
|
23 | + $abGroup = Route4Me::makeRequst([ |
|
24 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
25 | + 'method' => 'GET', |
|
26 | + 'query' => [ |
|
27 | + 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
28 | + ], |
|
29 | + ]); |
|
30 | + |
|
31 | + return $abGroup; |
|
32 | + } |
|
33 | + |
|
34 | + public static function updateAddressBookGroup(array $params) |
|
35 | + { |
|
36 | + $allBodyFields = ['group_id', 'group_color', 'group_icon', 'filter']; |
|
37 | + |
|
38 | + $abGroup = Route4Me::makeRequst([ |
|
39 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
40 | + 'method' => 'PUT', |
|
41 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
42 | + ]); |
|
43 | + |
|
44 | + return $abGroup; |
|
45 | + } |
|
46 | + |
|
47 | + public static function removeAddressBookGroup(array $params) |
|
48 | + { |
|
49 | + $allBodyFields = ['group_id']; |
|
50 | + |
|
51 | + $abGroup = Route4Me::makeRequst([ |
|
52 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
53 | + 'method' => 'DELETE', |
|
54 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
55 | + ]); |
|
56 | + |
|
57 | + return $abGroup; |
|
58 | + } |
|
59 | + |
|
60 | + public static function createAddressBookGroup(array $params) |
|
61 | + { |
|
62 | + $allBodyFields = ['group_name', 'group_color', 'group_icon', 'filter']; |
|
63 | + |
|
64 | + $abGroup = Route4Me::makeRequst([ |
|
65 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
66 | + 'method' => 'POST', |
|
67 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
68 | + ]); |
|
69 | + |
|
70 | + return $abGroup; |
|
71 | + } |
|
72 | + |
|
73 | + public static function searchAddressBookGroups(array $params) |
|
74 | + { |
|
75 | + $allBodyFields = ['fields', 'offset', 'limit', 'filter']; |
|
76 | + |
|
77 | + $abGroups = Route4Me::makeRequst([ |
|
78 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
79 | + 'method' => 'POST', |
|
80 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
81 | + ]); |
|
82 | + |
|
83 | + return $abGroups; |
|
84 | + } |
|
85 | + |
|
86 | + public static function getAddressBookContactsByGroup(array $params) |
|
87 | + { |
|
88 | + $allBodyFields = ['fields', 'group_id']; |
|
89 | + |
|
90 | + $abGroups = Route4Me::makeRequst([ |
|
91 | + 'url' => Endpoint::ADDRESS_BOOK_SEARCH, |
|
92 | + 'method' => 'POST', |
|
93 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
94 | + ]); |
|
95 | + |
|
96 | + return $abGroups; |
|
97 | + } |
|
98 | + |
|
99 | + public static function getAddressBookGroups(array $params) |
|
100 | + { |
|
101 | + $abGroup = Route4Me::makeRequst([ |
|
102 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
103 | + 'method' => 'GET', |
|
104 | + 'query' => [ |
|
105 | + 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
106 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
107 | + ], |
|
108 | + ]); |
|
109 | + |
|
110 | + return $abGroup; |
|
111 | + } |
|
112 | + |
|
113 | + public static function getRandomAddressBookGroup(array $params) |
|
114 | + { |
|
115 | + $abGroups = self::getAddressBookGroups($params); |
|
116 | + |
|
117 | + if (isset($abGroups) && sizeof($abGroups) > 1) { |
|
118 | + $groupsSize = sizeof($abGroups); |
|
119 | + |
|
120 | + $randomGroupIndex = rand(0, $groupsSize - 1); |
|
121 | + |
|
122 | + return $abGroups[$randomGroupIndex]; |
|
123 | + } |
|
124 | + |
|
125 | + return null; |
|
126 | + } |
|
127 | + |
|
128 | + /* |
|
129 | 129 | * Gets an array of the address book contact groups with a specified name. |
130 | 130 | * @param string $name |
131 | 131 | * Address book contact group name |
132 | 132 | */ |
133 | - public static function getAddressBookGroupIdByName($name) |
|
134 | - { |
|
135 | - $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
136 | - |
|
137 | - $abGroupId = []; |
|
138 | - |
|
139 | - foreach ($abGroups as $abg) { |
|
140 | - if (isset($abg['group_name'])) { |
|
141 | - if ($abg['group_name']==$name) { |
|
142 | - $abGroupId[] = $abg['group_id']; |
|
143 | - } |
|
144 | - } |
|
145 | - } |
|
146 | - |
|
147 | - return $abGroupId; |
|
148 | - } |
|
133 | + public static function getAddressBookGroupIdByName($name) |
|
134 | + { |
|
135 | + $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
136 | + |
|
137 | + $abGroupId = []; |
|
138 | + |
|
139 | + foreach ($abGroups as $abg) { |
|
140 | + if (isset($abg['group_name'])) { |
|
141 | + if ($abg['group_name']==$name) { |
|
142 | + $abGroupId[] = $abg['group_id']; |
|
143 | + } |
|
144 | + } |
|
145 | + } |
|
146 | + |
|
147 | + return $abGroupId; |
|
148 | + } |
|
149 | 149 | } |
@@ -10,39 +10,39 @@ |
||
10 | 10 | */ |
11 | 11 | class GeocodingResponse extends Common |
12 | 12 | { |
13 | - /** |
|
14 | - * A geocoded address |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - public $address; |
|
18 | - |
|
19 | - /** |
|
20 | - * Latitude |
|
21 | - * @var double |
|
22 | - */ |
|
23 | - public $lat; |
|
24 | - |
|
25 | - /** |
|
26 | - * Longitude |
|
27 | - * @var double |
|
28 | - */ |
|
29 | - public $lng; |
|
30 | - |
|
31 | - /** |
|
32 | - * Geocoded area level type |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - public $type; |
|
36 | - |
|
37 | - /** |
|
38 | - * Confidence ("high", "medium", "low") |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - public $confidence; |
|
42 | - |
|
43 | - /** |
|
44 | - * Content of the original string (an address or geopoint) sent by HTTP |
|
45 | - * @var Route |
|
46 | - */ |
|
47 | - public $original; |
|
13 | + /** |
|
14 | + * A geocoded address |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + public $address; |
|
18 | + |
|
19 | + /** |
|
20 | + * Latitude |
|
21 | + * @var double |
|
22 | + */ |
|
23 | + public $lat; |
|
24 | + |
|
25 | + /** |
|
26 | + * Longitude |
|
27 | + * @var double |
|
28 | + */ |
|
29 | + public $lng; |
|
30 | + |
|
31 | + /** |
|
32 | + * Geocoded area level type |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + public $type; |
|
36 | + |
|
37 | + /** |
|
38 | + * Confidence ("high", "medium", "low") |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + public $confidence; |
|
42 | + |
|
43 | + /** |
|
44 | + * Content of the original string (an address or geopoint) sent by HTTP |
|
45 | + * @var Route |
|
46 | + */ |
|
47 | + public $original; |
|
48 | 48 | } |
@@ -5,80 +5,80 @@ |
||
5 | 5 | |
6 | 6 | class OrderCustomField extends Common |
7 | 7 | { |
8 | - public $order_custom_field_id; |
|
9 | - public $order_custom_field_name; |
|
10 | - public $order_custom_field_label; |
|
11 | - public $order_custom_field_type; |
|
12 | - public $order_custom_field_value; |
|
13 | - public $root_owner_member_id; |
|
14 | - public $order_custom_field_type_info; |
|
15 | - |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | - } |
|
20 | - |
|
21 | - public static function addOrderCustomUserField($params) |
|
22 | - { |
|
23 | - $excludeFields = ['order_custom_field_id']; |
|
24 | - |
|
25 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
26 | - |
|
27 | - $response = Route4Me::makeRequst([ |
|
28 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
29 | - 'method' => 'POST', |
|
30 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
31 | - ]); |
|
32 | - |
|
33 | - return $response; |
|
34 | - } |
|
35 | - |
|
36 | - public static function getOrderCustomUserFields($params) |
|
37 | - { |
|
38 | - $allQueryFields = []; |
|
39 | - |
|
40 | - $response = Route4Me::makeRequst([ |
|
41 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
42 | - 'method' => 'GET', |
|
43 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
44 | - ]); |
|
45 | - |
|
46 | - return $response; |
|
47 | - } |
|
48 | - |
|
49 | - public static function updateOrderCustomUserField($params) |
|
50 | - { |
|
51 | - $excludeFields = ['order_custom_field_name']; |
|
52 | - |
|
53 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
54 | - |
|
55 | - $response = Route4Me::makeRequst([ |
|
56 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
57 | - 'method' => 'PUT', |
|
58 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
59 | - ]); |
|
60 | - |
|
61 | - return $response; |
|
62 | - } |
|
63 | - |
|
64 | - public static function removeOrderCustomUserField($params) |
|
65 | - { |
|
66 | - $excludeFields = [ |
|
67 | - 'order_custom_field_name', |
|
68 | - 'order_custom_field_type', |
|
69 | - 'order_custom_field_label', |
|
70 | - 'order_custom_field_type_info', |
|
71 | - 'root_owner_member_id' |
|
72 | - ]; |
|
73 | - |
|
74 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
75 | - |
|
76 | - $response = Route4Me::makeRequst([ |
|
77 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
78 | - 'method' => 'DELETE', |
|
79 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | - ]); |
|
81 | - |
|
82 | - return $response; |
|
83 | - } |
|
8 | + public $order_custom_field_id; |
|
9 | + public $order_custom_field_name; |
|
10 | + public $order_custom_field_label; |
|
11 | + public $order_custom_field_type; |
|
12 | + public $order_custom_field_value; |
|
13 | + public $root_owner_member_id; |
|
14 | + public $order_custom_field_type_info; |
|
15 | + |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | + } |
|
20 | + |
|
21 | + public static function addOrderCustomUserField($params) |
|
22 | + { |
|
23 | + $excludeFields = ['order_custom_field_id']; |
|
24 | + |
|
25 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
26 | + |
|
27 | + $response = Route4Me::makeRequst([ |
|
28 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
29 | + 'method' => 'POST', |
|
30 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
31 | + ]); |
|
32 | + |
|
33 | + return $response; |
|
34 | + } |
|
35 | + |
|
36 | + public static function getOrderCustomUserFields($params) |
|
37 | + { |
|
38 | + $allQueryFields = []; |
|
39 | + |
|
40 | + $response = Route4Me::makeRequst([ |
|
41 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
42 | + 'method' => 'GET', |
|
43 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
44 | + ]); |
|
45 | + |
|
46 | + return $response; |
|
47 | + } |
|
48 | + |
|
49 | + public static function updateOrderCustomUserField($params) |
|
50 | + { |
|
51 | + $excludeFields = ['order_custom_field_name']; |
|
52 | + |
|
53 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
54 | + |
|
55 | + $response = Route4Me::makeRequst([ |
|
56 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
57 | + 'method' => 'PUT', |
|
58 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
59 | + ]); |
|
60 | + |
|
61 | + return $response; |
|
62 | + } |
|
63 | + |
|
64 | + public static function removeOrderCustomUserField($params) |
|
65 | + { |
|
66 | + $excludeFields = [ |
|
67 | + 'order_custom_field_name', |
|
68 | + 'order_custom_field_type', |
|
69 | + 'order_custom_field_label', |
|
70 | + 'order_custom_field_type_info', |
|
71 | + 'root_owner_member_id' |
|
72 | + ]; |
|
73 | + |
|
74 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
75 | + |
|
76 | + $response = Route4Me::makeRequst([ |
|
77 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
78 | + 'method' => 'DELETE', |
|
79 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | + ]); |
|
81 | + |
|
82 | + return $response; |
|
83 | + } |
|
84 | 84 | } |
@@ -10,27 +10,27 @@ |
||
10 | 10 | */ |
11 | 11 | class SearchResponse extends Common |
12 | 12 | { |
13 | - /** |
|
14 | - * An array of the AddressBookContact type objects. |
|
15 | - * @var AddressBookLocation[] |
|
16 | - */ |
|
17 | - public $results=[]; |
|
13 | + /** |
|
14 | + * An array of the AddressBookContact type objects. |
|
15 | + * @var AddressBookLocation[] |
|
16 | + */ |
|
17 | + public $results=[]; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Total number of the returned contacts |
|
21 | - * @var integer |
|
22 | - */ |
|
23 | - public $total; |
|
19 | + /** |
|
20 | + * Total number of the returned contacts |
|
21 | + * @var integer |
|
22 | + */ |
|
23 | + public $total; |
|
24 | 24 | |
25 | - /** |
|
26 | - * An array of the field names to be shown |
|
27 | - * @var string[] |
|
28 | - */ |
|
29 | - public $fields=[]; |
|
25 | + /** |
|
26 | + * An array of the field names to be shown |
|
27 | + * @var string[] |
|
28 | + */ |
|
29 | + public $fields=[]; |
|
30 | 30 | |
31 | - /** |
|
32 | - * The contacts query in the JSON format |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - public $index_query; |
|
31 | + /** |
|
32 | + * The contacts query in the JSON format |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + public $index_query; |
|
36 | 36 | } |