@@ -13,13 +13,13 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Option extends Common |
| 15 | 15 | { |
| 16 | - public ?string $value = null; |
|
| 17 | - public ?string $title = null; |
|
| 16 | + public ?string $value = null; |
|
| 17 | + public ?string $title = null; |
|
| 18 | 18 | |
| 19 | - public function __construct(?array $params = null) |
|
| 20 | - { |
|
| 21 | - if ($params !== null) { |
|
| 22 | - $this->fillFromArray($params); |
|
| 23 | - } |
|
| 24 | - } |
|
| 19 | + public function __construct(?array $params = null) |
|
| 20 | + { |
|
| 21 | + if ($params !== null) { |
|
| 22 | + $this->fillFromArray($params); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -13,139 +13,139 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class ResponseTeam extends Common |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * The member ID |
|
| 18 | - */ |
|
| 19 | - public ?int $member_id = null; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * The user's account owner ID |
|
| 23 | - */ |
|
| 24 | - public ?int $OWNER_MEMBER_ID = null; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * User's first name |
|
| 28 | - */ |
|
| 29 | - public ?string $member_first_name = null; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * User's last name |
|
| 33 | - */ |
|
| 34 | - public ?string $member_last_name = null; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * User's email |
|
| 38 | - */ |
|
| 39 | - public ?string $member_email = null; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * User's image |
|
| 43 | - * @example '/uploads/cc6aba1a0e68ea429c51e3f9cb12e1ac/profile_c96135b77f6fc42be64cd98e0c21d341.jpg' |
|
| 44 | - */ |
|
| 45 | - public ?string $member_picture = null; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Member type. |
|
| 49 | - * Available values: 'PRIMARY_ACCOUNT', 'SUB_ACCOUNT_ADMIN', 'SUB_ACCOUNT_REGIONAL_MANAGER', |
|
| 50 | - * 'SUB_ACCOUNT_DISPATCHER', 'SUB_ACCOUNT_PLANNER', "SUB_ACCOUNT_DRIVER' |
|
| 51 | - * @example 'SUB_ACCOUNT_DISPATCHER' |
|
| 52 | - */ |
|
| 53 | - public ?string $member_type = null; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * If true, the routed addresses will be hidden. |
|
| 57 | - */ |
|
| 58 | - public ?bool $HIDE_ROUTED_ADDRESSES = null; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * If true, the visited addresses will be hidden. |
|
| 62 | - */ |
|
| 63 | - public ?bool $HIDE_VISITED_ADDRESSES = null; |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * If true, the nonfuture routes will be hidden. |
|
| 67 | - */ |
|
| 68 | - public ?bool $HIDE_NONFUTURE_ROUTES = null; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * If true, the user has read-only access type. |
|
| 72 | - */ |
|
| 73 | - public ?bool $READONLY_USER = null; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * If true, the global address book contacts are visible in a user account. |
|
| 77 | - */ |
|
| 78 | - public ?bool $SHOW_SUSR_ADDR = null; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * If true, the global orders are visible in a user account. |
|
| 82 | - */ |
|
| 83 | - public ?bool $SHOW_SUSR_ORDERS = null; |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * If true, all drivers are visible to the user. |
|
| 87 | - */ |
|
| 88 | - public ?bool $SHOW_ALL_DRIVERS = null; |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * If true, all vehicles are visible to the user. |
|
| 92 | - */ |
|
| 93 | - public ?bool $SHOW_ALL_VEHICLES = null; |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Allowed sub-member types in the user's account. |
|
| 97 | - * String array, available types: 'SUB_ACCOUNT_DRIVER', 'SUB_ACCOUNT_DISPATCHER', |
|
| 98 | - * 'SUB_ACCOUNT_PLANNER', 'SUB_ACCOUNT_ANALYST', 'SUB_ACCOUNT_ADMIN', 'SUB_ACCOUNT_REGIONAL_MANAGER' |
|
| 99 | - */ |
|
| 100 | - public ?array $allowed_submember_types = null; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * If true, the user can edit the account data. |
|
| 104 | - */ |
|
| 105 | - public ?bool $can_edit = null; |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * If true, the user can delete the account data. |
|
| 109 | - */ |
|
| 110 | - public ?bool $can_delete = null; |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * The user's custom data. |
|
| 114 | - * @example ['custom_data_key' => 'custom_data_value'] |
|
| 115 | - */ |
|
| 116 | - public ?array $custom_data = null; |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Optimization profile ID |
|
| 120 | - * @example '18a6e1c5-0a02-4c58-a2d3-5c842ab550be' |
|
| 121 | - */ |
|
| 122 | - public ?string $optimization_profile_id = null; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Member type title |
|
| 126 | - */ |
|
| 127 | - public ?string $member_type_title = null; |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * User's permissions |
|
| 131 | - */ |
|
| 132 | - public ?array $permissions = null; |
|
| 133 | - |
|
| 134 | - public function __construct(?array $params = null) |
|
| 135 | - { |
|
| 136 | - if ($params !== null) { |
|
| 137 | - foreach ($this as $key => $value) { |
|
| 138 | - if (isset($params[$key])) { |
|
| 139 | - if ($key === 'permissions') { |
|
| 140 | - $this->{$key} = array(); |
|
| 141 | - foreach ($params[$key] as $perm_key => $perm_value) { |
|
| 142 | - array_push($this->{$key}, new Permission($perm_value)); |
|
| 143 | - } |
|
| 144 | - } else { |
|
| 145 | - $this->{$key} = $params[$key]; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - } |
|
| 150 | - } |
|
| 16 | + /** |
|
| 17 | + * The member ID |
|
| 18 | + */ |
|
| 19 | + public ?int $member_id = null; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * The user's account owner ID |
|
| 23 | + */ |
|
| 24 | + public ?int $OWNER_MEMBER_ID = null; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * User's first name |
|
| 28 | + */ |
|
| 29 | + public ?string $member_first_name = null; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * User's last name |
|
| 33 | + */ |
|
| 34 | + public ?string $member_last_name = null; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * User's email |
|
| 38 | + */ |
|
| 39 | + public ?string $member_email = null; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * User's image |
|
| 43 | + * @example '/uploads/cc6aba1a0e68ea429c51e3f9cb12e1ac/profile_c96135b77f6fc42be64cd98e0c21d341.jpg' |
|
| 44 | + */ |
|
| 45 | + public ?string $member_picture = null; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Member type. |
|
| 49 | + * Available values: 'PRIMARY_ACCOUNT', 'SUB_ACCOUNT_ADMIN', 'SUB_ACCOUNT_REGIONAL_MANAGER', |
|
| 50 | + * 'SUB_ACCOUNT_DISPATCHER', 'SUB_ACCOUNT_PLANNER', "SUB_ACCOUNT_DRIVER' |
|
| 51 | + * @example 'SUB_ACCOUNT_DISPATCHER' |
|
| 52 | + */ |
|
| 53 | + public ?string $member_type = null; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * If true, the routed addresses will be hidden. |
|
| 57 | + */ |
|
| 58 | + public ?bool $HIDE_ROUTED_ADDRESSES = null; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * If true, the visited addresses will be hidden. |
|
| 62 | + */ |
|
| 63 | + public ?bool $HIDE_VISITED_ADDRESSES = null; |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * If true, the nonfuture routes will be hidden. |
|
| 67 | + */ |
|
| 68 | + public ?bool $HIDE_NONFUTURE_ROUTES = null; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * If true, the user has read-only access type. |
|
| 72 | + */ |
|
| 73 | + public ?bool $READONLY_USER = null; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * If true, the global address book contacts are visible in a user account. |
|
| 77 | + */ |
|
| 78 | + public ?bool $SHOW_SUSR_ADDR = null; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * If true, the global orders are visible in a user account. |
|
| 82 | + */ |
|
| 83 | + public ?bool $SHOW_SUSR_ORDERS = null; |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * If true, all drivers are visible to the user. |
|
| 87 | + */ |
|
| 88 | + public ?bool $SHOW_ALL_DRIVERS = null; |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * If true, all vehicles are visible to the user. |
|
| 92 | + */ |
|
| 93 | + public ?bool $SHOW_ALL_VEHICLES = null; |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Allowed sub-member types in the user's account. |
|
| 97 | + * String array, available types: 'SUB_ACCOUNT_DRIVER', 'SUB_ACCOUNT_DISPATCHER', |
|
| 98 | + * 'SUB_ACCOUNT_PLANNER', 'SUB_ACCOUNT_ANALYST', 'SUB_ACCOUNT_ADMIN', 'SUB_ACCOUNT_REGIONAL_MANAGER' |
|
| 99 | + */ |
|
| 100 | + public ?array $allowed_submember_types = null; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * If true, the user can edit the account data. |
|
| 104 | + */ |
|
| 105 | + public ?bool $can_edit = null; |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * If true, the user can delete the account data. |
|
| 109 | + */ |
|
| 110 | + public ?bool $can_delete = null; |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * The user's custom data. |
|
| 114 | + * @example ['custom_data_key' => 'custom_data_value'] |
|
| 115 | + */ |
|
| 116 | + public ?array $custom_data = null; |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Optimization profile ID |
|
| 120 | + * @example '18a6e1c5-0a02-4c58-a2d3-5c842ab550be' |
|
| 121 | + */ |
|
| 122 | + public ?string $optimization_profile_id = null; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Member type title |
|
| 126 | + */ |
|
| 127 | + public ?string $member_type_title = null; |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * User's permissions |
|
| 131 | + */ |
|
| 132 | + public ?array $permissions = null; |
|
| 133 | + |
|
| 134 | + public function __construct(?array $params = null) |
|
| 135 | + { |
|
| 136 | + if ($params !== null) { |
|
| 137 | + foreach ($this as $key => $value) { |
|
| 138 | + if (isset($params[$key])) { |
|
| 139 | + if ($key === 'permissions') { |
|
| 140 | + $this->{$key} = array(); |
|
| 141 | + foreach ($params[$key] as $perm_key => $perm_value) { |
|
| 142 | + array_push($this->{$key}, new Permission($perm_value)); |
|
| 143 | + } |
|
| 144 | + } else { |
|
| 145 | + $this->{$key} = $params[$key]; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | 151 | } |
@@ -14,35 +14,35 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Permission extends Common |
| 16 | 16 | { |
| 17 | - public ?string $id = null; |
|
| 18 | - public ?string $title = null; |
|
| 19 | - public ?string $type = null; |
|
| 17 | + public ?string $id = null; |
|
| 18 | + public ?string $title = null; |
|
| 19 | + public ?string $type = null; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Array of Options |
|
| 23 | - */ |
|
| 24 | - public ?array $options = null; |
|
| 21 | + /** |
|
| 22 | + * Array of Options |
|
| 23 | + */ |
|
| 24 | + public ?array $options = null; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Array of strings |
|
| 28 | - */ |
|
| 29 | - public ?array $value = null; |
|
| 26 | + /** |
|
| 27 | + * Array of strings |
|
| 28 | + */ |
|
| 29 | + public ?array $value = null; |
|
| 30 | 30 | |
| 31 | - public function __construct(?array $params = null) |
|
| 32 | - { |
|
| 33 | - if ($params !== null) { |
|
| 34 | - foreach ($this as $key => $value) { |
|
| 35 | - if (isset($params[$key])) { |
|
| 36 | - if ($key === 'options') { |
|
| 37 | - $this->{$key} = array(); |
|
| 38 | - foreach ($params[$key] as $opt_key => $opt_value) { |
|
| 39 | - array_push($this->{$key}, new Option($opt_value)); |
|
| 40 | - } |
|
| 41 | - } else { |
|
| 42 | - $this->{$key} = $params[$key]; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 31 | + public function __construct(?array $params = null) |
|
| 32 | + { |
|
| 33 | + if ($params !== null) { |
|
| 34 | + foreach ($this as $key => $value) { |
|
| 35 | + if (isset($params[$key])) { |
|
| 36 | + if ($key === 'options') { |
|
| 37 | + $this->{$key} = array(); |
|
| 38 | + foreach ($params[$key] as $opt_key => $opt_value) { |
|
| 39 | + array_push($this->{$key}, new Option($opt_value)); |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $this->{$key} = $params[$key]; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -17,277 +17,277 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class TeamManagement extends Common |
| 19 | 19 | { |
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - Route4Me::setBaseUrl(''); |
|
| 23 | - } |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + Route4Me::setBaseUrl(''); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Add a new sub-user to the Member account by sending the corresponding |
|
| 27 | - * body payload with the sub-users' parameters. |
|
| 28 | - * |
|
| 29 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 30 | - * |
|
| 31 | - * @param array $params - Sub-user properties. |
|
| 32 | - * string new_password - Password. |
|
| 33 | - * string new_member_picture - Member picture. |
|
| 34 | - * string member_first_name - First name. |
|
| 35 | - * string member_last_name - Last name. |
|
| 36 | - * string member_email - E-mail. |
|
| 37 | - * string member_company - Company. |
|
| 38 | - * string member_type - Member type. |
|
| 39 | - * int OWNER_MEMBER_ID - Owner member ID. |
|
| 40 | - * string member_phone - Phone. |
|
| 41 | - * string date_of_birth - Date of birth. |
|
| 42 | - * int user_reg_state_id - User state ID. |
|
| 43 | - * int user_reg_country_id - User country ID. |
|
| 44 | - * float DriverHourlyRate - Drive hourly rate. |
|
| 45 | - * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 46 | - * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 47 | - * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 48 | - * bool READONLY_USER - Readonly user. |
|
| 49 | - * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 50 | - * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 51 | - * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 52 | - * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 53 | - * bool display_max_routes_future_days - Display max routes. |
|
| 54 | - * int vendor_id - Vendoe ID. |
|
| 55 | - * float driving_rate - Driving rate. |
|
| 56 | - * float working_rate - Working rate. |
|
| 57 | - * float mile_rate - Mile rate. |
|
| 58 | - * float idling_rate - Idling rate. |
|
| 59 | - * string timezone - Timezone. |
|
| 60 | - * string optimization_profile_id - Optimization profile ID. |
|
| 61 | - * array permissions - Array of permissions |
|
| 62 | - * string id - ID of permission |
|
| 63 | - * array value - Array of string values |
|
| 64 | - * @return ResponseTeam |
|
| 65 | - * @throws Exception\ApiError |
|
| 66 | - */ |
|
| 67 | - public function create(array $params) : ResponseTeam |
|
| 68 | - { |
|
| 69 | - $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 70 | - 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 71 | - 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 72 | - 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 73 | - 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 74 | - 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 75 | - ]; |
|
| 25 | + /** |
|
| 26 | + * Add a new sub-user to the Member account by sending the corresponding |
|
| 27 | + * body payload with the sub-users' parameters. |
|
| 28 | + * |
|
| 29 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 30 | + * |
|
| 31 | + * @param array $params - Sub-user properties. |
|
| 32 | + * string new_password - Password. |
|
| 33 | + * string new_member_picture - Member picture. |
|
| 34 | + * string member_first_name - First name. |
|
| 35 | + * string member_last_name - Last name. |
|
| 36 | + * string member_email - E-mail. |
|
| 37 | + * string member_company - Company. |
|
| 38 | + * string member_type - Member type. |
|
| 39 | + * int OWNER_MEMBER_ID - Owner member ID. |
|
| 40 | + * string member_phone - Phone. |
|
| 41 | + * string date_of_birth - Date of birth. |
|
| 42 | + * int user_reg_state_id - User state ID. |
|
| 43 | + * int user_reg_country_id - User country ID. |
|
| 44 | + * float DriverHourlyRate - Drive hourly rate. |
|
| 45 | + * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 46 | + * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 47 | + * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 48 | + * bool READONLY_USER - Readonly user. |
|
| 49 | + * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 50 | + * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 51 | + * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 52 | + * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 53 | + * bool display_max_routes_future_days - Display max routes. |
|
| 54 | + * int vendor_id - Vendoe ID. |
|
| 55 | + * float driving_rate - Driving rate. |
|
| 56 | + * float working_rate - Working rate. |
|
| 57 | + * float mile_rate - Mile rate. |
|
| 58 | + * float idling_rate - Idling rate. |
|
| 59 | + * string timezone - Timezone. |
|
| 60 | + * string optimization_profile_id - Optimization profile ID. |
|
| 61 | + * array permissions - Array of permissions |
|
| 62 | + * string id - ID of permission |
|
| 63 | + * array value - Array of string values |
|
| 64 | + * @return ResponseTeam |
|
| 65 | + * @throws Exception\ApiError |
|
| 66 | + */ |
|
| 67 | + public function create(array $params) : ResponseTeam |
|
| 68 | + { |
|
| 69 | + $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 70 | + 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 71 | + 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 72 | + 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 73 | + 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 74 | + 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 75 | + ]; |
|
| 76 | 76 | |
| 77 | - return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 78 | - 'url' => Endpoint::TEAM_USERS, |
|
| 79 | - 'method' => 'POST', |
|
| 80 | - 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 81 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 82 | - ])); |
|
| 83 | - } |
|
| 77 | + return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 78 | + 'url' => Endpoint::TEAM_USERS, |
|
| 79 | + 'method' => 'POST', |
|
| 80 | + 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 81 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 82 | + ])); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * View all existing sub-users associated with the Member’s account. |
|
| 87 | - * |
|
| 88 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 89 | - * |
|
| 90 | - * @return ResponseTeam[] |
|
| 91 | - * @throws Exception\ApiError |
|
| 92 | - */ |
|
| 93 | - public function getUsers() : ?array |
|
| 94 | - { |
|
| 95 | - $result = Route4Me::makeRequst([ |
|
| 96 | - 'url' => Endpoint::TEAM_USERS, |
|
| 97 | - 'method' => 'GET' |
|
| 98 | - ]); |
|
| 85 | + /** |
|
| 86 | + * View all existing sub-users associated with the Member’s account. |
|
| 87 | + * |
|
| 88 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 89 | + * |
|
| 90 | + * @return ResponseTeam[] |
|
| 91 | + * @throws Exception\ApiError |
|
| 92 | + */ |
|
| 93 | + public function getUsers() : ?array |
|
| 94 | + { |
|
| 95 | + $result = Route4Me::makeRequst([ |
|
| 96 | + 'url' => Endpoint::TEAM_USERS, |
|
| 97 | + 'method' => 'GET' |
|
| 98 | + ]); |
|
| 99 | 99 | |
| 100 | - if (is_array($result)) { |
|
| 101 | - $arr = []; |
|
| 102 | - foreach ($result as $key => $value) { |
|
| 103 | - array_push($arr, $this->toResponseTeam($value)); |
|
| 104 | - } |
|
| 105 | - return $arr; |
|
| 106 | - } |
|
| 107 | - return null; |
|
| 108 | - } |
|
| 100 | + if (is_array($result)) { |
|
| 101 | + $arr = []; |
|
| 102 | + foreach ($result as $key => $value) { |
|
| 103 | + array_push($arr, $this->toResponseTeam($value)); |
|
| 104 | + } |
|
| 105 | + return $arr; |
|
| 106 | + } |
|
| 107 | + return null; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Get the sub-user by specifying the path parameter ID. |
|
| 112 | - * |
|
| 113 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 114 | - * |
|
| 115 | - * @param int $userId - User ID. |
|
| 116 | - * @return ResponseTeam |
|
| 117 | - * @throws Exception\ApiError |
|
| 118 | - */ |
|
| 119 | - public function getUser(int $userId) : ResponseTeam |
|
| 120 | - { |
|
| 121 | - return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 122 | - 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 123 | - 'method' => 'GET' |
|
| 124 | - ])); |
|
| 125 | - } |
|
| 110 | + /** |
|
| 111 | + * Get the sub-user by specifying the path parameter ID. |
|
| 112 | + * |
|
| 113 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 114 | + * |
|
| 115 | + * @param int $userId - User ID. |
|
| 116 | + * @return ResponseTeam |
|
| 117 | + * @throws Exception\ApiError |
|
| 118 | + */ |
|
| 119 | + public function getUser(int $userId) : ResponseTeam |
|
| 120 | + { |
|
| 121 | + return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 122 | + 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 123 | + 'method' => 'GET' |
|
| 124 | + ])); |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Delete the sub-user by specifying the path parameter ID. |
|
| 129 | - * |
|
| 130 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 131 | - * |
|
| 132 | - * @param int $userId - User ID. |
|
| 133 | - * @return ResponseTeam - Deleted object |
|
| 134 | - * @throws Exception\ApiError |
|
| 135 | - */ |
|
| 136 | - public function delete(int $userId) : ResponseTeam |
|
| 137 | - { |
|
| 138 | - return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 139 | - 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 140 | - 'method' => 'DELETE' |
|
| 141 | - ])); |
|
| 142 | - } |
|
| 127 | + /** |
|
| 128 | + * Delete the sub-user by specifying the path parameter ID. |
|
| 129 | + * |
|
| 130 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 131 | + * |
|
| 132 | + * @param int $userId - User ID. |
|
| 133 | + * @return ResponseTeam - Deleted object |
|
| 134 | + * @throws Exception\ApiError |
|
| 135 | + */ |
|
| 136 | + public function delete(int $userId) : ResponseTeam |
|
| 137 | + { |
|
| 138 | + return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 139 | + 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 140 | + 'method' => 'DELETE' |
|
| 141 | + ])); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Update the sub-user by specifying the path parameter ID and by sending the |
|
| 146 | - * corresponding body payload with the sub-user's parameters.. |
|
| 147 | - * |
|
| 148 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 149 | - * |
|
| 150 | - * @param int $userId - User ID. |
|
| 151 | - * @param array $params - Sub-user properties. |
|
| 152 | - * string new_password - Password. |
|
| 153 | - * string new_member_picture - Member picture. |
|
| 154 | - * string member_first_name - First name. |
|
| 155 | - * string member_last_name - Last name. |
|
| 156 | - * string member_email - E-mail. |
|
| 157 | - * string member_company - Company. |
|
| 158 | - * string member_type - Member type. |
|
| 159 | - * int OWNER_MEMBER_ID - Owner member ID. |
|
| 160 | - * string member_phone - Phone. |
|
| 161 | - * string date_of_birth - Date of birth. |
|
| 162 | - * int user_reg_state_id - User state ID. |
|
| 163 | - * int user_reg_country_id - User country ID. |
|
| 164 | - * float DriverHourlyRate - Drive hourly rate. |
|
| 165 | - * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 166 | - * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 167 | - * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 168 | - * bool READONLY_USER - Readonly user. |
|
| 169 | - * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 170 | - * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 171 | - * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 172 | - * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 173 | - * bool display_max_routes_future_days - Display max routes. |
|
| 174 | - * int vendor_id - Vendoe ID. |
|
| 175 | - * float driving_rate - Driving rate. |
|
| 176 | - * float working_rate - Working rate. |
|
| 177 | - * float mile_rate - Mile rate. |
|
| 178 | - * float idling_rate - Idling rate. |
|
| 179 | - * string timezone - Timezone. |
|
| 180 | - * string optimization_profile_id - Optimization profile ID. |
|
| 181 | - * array permissions - Array of permissions |
|
| 182 | - * string id - ID of permission |
|
| 183 | - * array value - Array of string values |
|
| 184 | - * @return ResponseTeam |
|
| 185 | - * @throws Exception\ApiError |
|
| 186 | - */ |
|
| 187 | - public function update(int $userId, array $params) : ResponseTeam |
|
| 188 | - { |
|
| 189 | - $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 190 | - 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 191 | - 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 192 | - 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 193 | - 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 194 | - 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 195 | - ]; |
|
| 144 | + /** |
|
| 145 | + * Update the sub-user by specifying the path parameter ID and by sending the |
|
| 146 | + * corresponding body payload with the sub-user's parameters.. |
|
| 147 | + * |
|
| 148 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 149 | + * |
|
| 150 | + * @param int $userId - User ID. |
|
| 151 | + * @param array $params - Sub-user properties. |
|
| 152 | + * string new_password - Password. |
|
| 153 | + * string new_member_picture - Member picture. |
|
| 154 | + * string member_first_name - First name. |
|
| 155 | + * string member_last_name - Last name. |
|
| 156 | + * string member_email - E-mail. |
|
| 157 | + * string member_company - Company. |
|
| 158 | + * string member_type - Member type. |
|
| 159 | + * int OWNER_MEMBER_ID - Owner member ID. |
|
| 160 | + * string member_phone - Phone. |
|
| 161 | + * string date_of_birth - Date of birth. |
|
| 162 | + * int user_reg_state_id - User state ID. |
|
| 163 | + * int user_reg_country_id - User country ID. |
|
| 164 | + * float DriverHourlyRate - Drive hourly rate. |
|
| 165 | + * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 166 | + * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 167 | + * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 168 | + * bool READONLY_USER - Readonly user. |
|
| 169 | + * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 170 | + * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 171 | + * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 172 | + * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 173 | + * bool display_max_routes_future_days - Display max routes. |
|
| 174 | + * int vendor_id - Vendoe ID. |
|
| 175 | + * float driving_rate - Driving rate. |
|
| 176 | + * float working_rate - Working rate. |
|
| 177 | + * float mile_rate - Mile rate. |
|
| 178 | + * float idling_rate - Idling rate. |
|
| 179 | + * string timezone - Timezone. |
|
| 180 | + * string optimization_profile_id - Optimization profile ID. |
|
| 181 | + * array permissions - Array of permissions |
|
| 182 | + * string id - ID of permission |
|
| 183 | + * array value - Array of string values |
|
| 184 | + * @return ResponseTeam |
|
| 185 | + * @throws Exception\ApiError |
|
| 186 | + */ |
|
| 187 | + public function update(int $userId, array $params) : ResponseTeam |
|
| 188 | + { |
|
| 189 | + $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 190 | + 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 191 | + 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 192 | + 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 193 | + 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 194 | + 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 195 | + ]; |
|
| 196 | 196 | |
| 197 | - return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 198 | - 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 199 | - 'method' => 'PATCH', |
|
| 200 | - 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 201 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 202 | - ])); |
|
| 203 | - } |
|
| 197 | + return $this->toResponseTeam(Route4Me::makeRequst([ |
|
| 198 | + 'url' => Endpoint::TEAM_USERS . '/' . $userId, |
|
| 199 | + 'method' => 'PATCH', |
|
| 200 | + 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 201 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 202 | + ])); |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - /** |
|
| 206 | - * Add multiple sub-users to the User account by sending the corresponding |
|
| 207 | - * body payload with the array of the sub-users' parameters |
|
| 208 | - * |
|
| 209 | - * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 210 | - * |
|
| 211 | - * @param array $params - Array of array of Sub-user properties. |
|
| 212 | - * string new_password - Password. |
|
| 213 | - * string new_member_picture - Member picture. |
|
| 214 | - * string member_first_name - First name. |
|
| 215 | - * string member_last_name - Last name. |
|
| 216 | - * string member_email - E-mail. |
|
| 217 | - * string member_company - Company. |
|
| 218 | - * string member_type - Member type. |
|
| 219 | - * int OWNER_MEMBER_ID - Owner member ID. |
|
| 220 | - * string member_phone - Phone. |
|
| 221 | - * string date_of_birth - Date of birth. |
|
| 222 | - * int user_reg_state_id - User state ID. |
|
| 223 | - * int user_reg_country_id - User country ID. |
|
| 224 | - * float DriverHourlyRate - Drive hourly rate. |
|
| 225 | - * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 226 | - * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 227 | - * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 228 | - * bool READONLY_USER - Readonly user. |
|
| 229 | - * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 230 | - * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 231 | - * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 232 | - * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 233 | - * bool display_max_routes_future_days - Display max routes. |
|
| 234 | - * int vendor_id - Vendoe ID. |
|
| 235 | - * float driving_rate - Driving rate. |
|
| 236 | - * float working_rate - Working rate. |
|
| 237 | - * float mile_rate - Mile rate. |
|
| 238 | - * float idling_rate - Idling rate. |
|
| 239 | - * string timezone - Timezone. |
|
| 240 | - * string optimization_profile_id - Optimization profile ID. |
|
| 241 | - * array permissions - Array of permissions |
|
| 242 | - * string id - ID of permission |
|
| 243 | - * array value - Array of string values |
|
| 244 | - * @param array options - Array of insert options. |
|
| 245 | - * string [api_key] - User API key. |
|
| 246 | - * string [conflicts] - Conflict resolving rule. |
|
| 247 | - * Possible values: 'fail', 'overwrite' and 'skip'. |
|
| 248 | - * @return ResponseTeam |
|
| 249 | - * @throws Exception\ApiError |
|
| 250 | - */ |
|
| 251 | - public function bulkInsert(array $params, ?array $options = null) |
|
| 252 | - { |
|
| 253 | - $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 254 | - 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 255 | - 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 256 | - 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 257 | - 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 258 | - 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 259 | - ]; |
|
| 205 | + /** |
|
| 206 | + * Add multiple sub-users to the User account by sending the corresponding |
|
| 207 | + * body payload with the array of the sub-users' parameters |
|
| 208 | + * |
|
| 209 | + * @see {@link https://virtserver.swaggerhub.com/Route4Me} |
|
| 210 | + * |
|
| 211 | + * @param array $params - Array of array of Sub-user properties. |
|
| 212 | + * string new_password - Password. |
|
| 213 | + * string new_member_picture - Member picture. |
|
| 214 | + * string member_first_name - First name. |
|
| 215 | + * string member_last_name - Last name. |
|
| 216 | + * string member_email - E-mail. |
|
| 217 | + * string member_company - Company. |
|
| 218 | + * string member_type - Member type. |
|
| 219 | + * int OWNER_MEMBER_ID - Owner member ID. |
|
| 220 | + * string member_phone - Phone. |
|
| 221 | + * string date_of_birth - Date of birth. |
|
| 222 | + * int user_reg_state_id - User state ID. |
|
| 223 | + * int user_reg_country_id - User country ID. |
|
| 224 | + * float DriverHourlyRate - Drive hourly rate. |
|
| 225 | + * bool HIDE_ROUTED_ADDRESSES - Hide routed addresses. |
|
| 226 | + * bool HIDE_VISITED_ADDRESSES - Hide visited addresses. |
|
| 227 | + * bool HIDE_NONFUTURE_ROUTES - Hide nonfuture routes. |
|
| 228 | + * bool READONLY_USER - Readonly user. |
|
| 229 | + * bool SHOW_SUSR_ADDR - Show sub-user addresses. |
|
| 230 | + * bool SHOW_SUSR_ORDERS - Show sub-user orders. |
|
| 231 | + * bool SHOW_ALL_DRIVERS - Show all drivers. |
|
| 232 | + * bool SHOW_ALL_VEHICLES - Show all vehicles. |
|
| 233 | + * bool display_max_routes_future_days - Display max routes. |
|
| 234 | + * int vendor_id - Vendoe ID. |
|
| 235 | + * float driving_rate - Driving rate. |
|
| 236 | + * float working_rate - Working rate. |
|
| 237 | + * float mile_rate - Mile rate. |
|
| 238 | + * float idling_rate - Idling rate. |
|
| 239 | + * string timezone - Timezone. |
|
| 240 | + * string optimization_profile_id - Optimization profile ID. |
|
| 241 | + * array permissions - Array of permissions |
|
| 242 | + * string id - ID of permission |
|
| 243 | + * array value - Array of string values |
|
| 244 | + * @param array options - Array of insert options. |
|
| 245 | + * string [api_key] - User API key. |
|
| 246 | + * string [conflicts] - Conflict resolving rule. |
|
| 247 | + * Possible values: 'fail', 'overwrite' and 'skip'. |
|
| 248 | + * @return ResponseTeam |
|
| 249 | + * @throws Exception\ApiError |
|
| 250 | + */ |
|
| 251 | + public function bulkInsert(array $params, ?array $options = null) |
|
| 252 | + { |
|
| 253 | + $allBodyFields = ['new_password', 'new_member_picture', 'member_first_name', 'member_last_name', |
|
| 254 | + 'member_email', 'member_company', 'member_type', 'OWNER_MEMBER_ID', 'member_phone', 'date_of_birth', |
|
| 255 | + 'user_reg_state_id', 'user_reg_country_id', 'DriverHourlyRate', 'HIDE_ROUTED_ADDRESSES', |
|
| 256 | + 'HIDE_VISITED_ADDRESSES', 'HIDE_NONFUTURE_ROUTES', 'READONLY_USER', 'SHOW_SUSR_ADDR', 'SHOW_SUSR_ORDERS', |
|
| 257 | + 'SHOW_ALL_DRIVERS', 'SHOW_ALL_VEHICLES', 'display_max_routes_future_days', 'vendor_id', 'driving_rate', |
|
| 258 | + 'working_rate', 'mile_rate', 'idling_rate', 'timezone', 'optimization_profile_id', 'permissions' |
|
| 259 | + ]; |
|
| 260 | 260 | |
| 261 | - $allQueryFields = ['api_key', 'conflicts']; |
|
| 261 | + $allQueryFields = ['api_key', 'conflicts']; |
|
| 262 | 262 | |
| 263 | - $body = []; |
|
| 264 | - foreach ($params as $key => $value) { |
|
| 265 | - $body[] = Route4Me::generateRequestParameters($allBodyFields, $value); |
|
| 266 | - } |
|
| 263 | + $body = []; |
|
| 264 | + foreach ($params as $key => $value) { |
|
| 265 | + $body[] = Route4Me::generateRequestParameters($allBodyFields, $value); |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - $result = Route4Me::makeRequst([ |
|
| 269 | - 'url' => Endpoint::TEAM_USERS_BULK_INSERT, |
|
| 270 | - 'method' => 'POST', |
|
| 271 | - 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 272 | - 'body' => ['users' => $body], |
|
| 273 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $options) |
|
| 274 | - ]); |
|
| 268 | + $result = Route4Me::makeRequst([ |
|
| 269 | + 'url' => Endpoint::TEAM_USERS_BULK_INSERT, |
|
| 270 | + 'method' => 'POST', |
|
| 271 | + 'HTTPHEADER' => 'Content-Type: application/json', |
|
| 272 | + 'body' => ['users' => $body], |
|
| 273 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $options) |
|
| 274 | + ]); |
|
| 275 | 275 | |
| 276 | - if (is_array($result)) { |
|
| 277 | - $arr = []; |
|
| 278 | - foreach ($result as $key => $value) { |
|
| 279 | - array_push($arr, $this->toResponseTeam($value)); |
|
| 280 | - } |
|
| 281 | - return $arr; |
|
| 282 | - } |
|
| 283 | - return null; |
|
| 284 | - } |
|
| 276 | + if (is_array($result)) { |
|
| 277 | + $arr = []; |
|
| 278 | + foreach ($result as $key => $value) { |
|
| 279 | + array_push($arr, $this->toResponseTeam($value)); |
|
| 280 | + } |
|
| 281 | + return $arr; |
|
| 282 | + } |
|
| 283 | + return null; |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - private function toResponseTeam($result) : ResponseTeam |
|
| 287 | - { |
|
| 288 | - if (is_array($result)) { |
|
| 289 | - return new ResponseTeam($result); |
|
| 290 | - } |
|
| 291 | - throw new ApiError('Can not convert result to ResponseTeam object.'); |
|
| 292 | - } |
|
| 286 | + private function toResponseTeam($result) : ResponseTeam |
|
| 287 | + { |
|
| 288 | + if (is_array($result)) { |
|
| 289 | + return new ResponseTeam($result); |
|
| 290 | + } |
|
| 291 | + throw new ApiError('Can not convert result to ResponseTeam object.'); |
|
| 292 | + } |
|
| 293 | 293 | } |
@@ -18,37 +18,37 @@ |
||
| 18 | 18 | Route4Me::setApiKey(Constants::API_KEY); |
| 19 | 19 | |
| 20 | 20 | try { |
| 21 | - // get OWNER_MEMBER_ID |
|
| 22 | - $owner_member_id = null; |
|
| 23 | - $member = new Member(); |
|
| 24 | - $res_members = $member->getUsers(); |
|
| 25 | - |
|
| 26 | - if (is_array($res_members) && isset($res_members['results'])) { |
|
| 27 | - foreach ($res_members['results'] as $key => $value) { |
|
| 28 | - if ($value['OWNER_MEMBER_ID'] == 0) { |
|
| 29 | - $owner_member_id = $value['member_id']; |
|
| 30 | - break; |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - if (!$owner_member_id) { |
|
| 36 | - throw new Exception("Cannot find OWNER_MEMBER_ID."); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - // new sub-user |
|
| 40 | - $params = [ |
|
| 41 | - 'new_password' => '12345#Tusha', |
|
| 42 | - 'member_first_name' => 'Tusha I', |
|
| 43 | - 'member_last_name' => 'Pupkindzes', |
|
| 44 | - 'member_email' => '[email protected]', |
|
| 45 | - 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 46 | - 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 47 | - ]; |
|
| 48 | - |
|
| 49 | - $tm = new TeamManagement(); |
|
| 50 | - $res = $tm->create($params); |
|
| 51 | - print_r($res); |
|
| 21 | + // get OWNER_MEMBER_ID |
|
| 22 | + $owner_member_id = null; |
|
| 23 | + $member = new Member(); |
|
| 24 | + $res_members = $member->getUsers(); |
|
| 25 | + |
|
| 26 | + if (is_array($res_members) && isset($res_members['results'])) { |
|
| 27 | + foreach ($res_members['results'] as $key => $value) { |
|
| 28 | + if ($value['OWNER_MEMBER_ID'] == 0) { |
|
| 29 | + $owner_member_id = $value['member_id']; |
|
| 30 | + break; |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + if (!$owner_member_id) { |
|
| 36 | + throw new Exception("Cannot find OWNER_MEMBER_ID."); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + // new sub-user |
|
| 40 | + $params = [ |
|
| 41 | + 'new_password' => '12345#Tusha', |
|
| 42 | + 'member_first_name' => 'Tusha I', |
|
| 43 | + 'member_last_name' => 'Pupkindzes', |
|
| 44 | + 'member_email' => '[email protected]', |
|
| 45 | + 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 46 | + 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 47 | + ]; |
|
| 48 | + |
|
| 49 | + $tm = new TeamManagement(); |
|
| 50 | + $res = $tm->create($params); |
|
| 51 | + print_r($res); |
|
| 52 | 52 | } catch (Exception | ApiError $e) { |
| 53 | - echo $e->getMessage() . PHP_EOL; |
|
| 53 | + echo $e->getMessage() . PHP_EOL; |
|
| 54 | 54 | } |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | $userId = 2565363; |
| 19 | 19 | |
| 20 | 20 | try { |
| 21 | - $tm = new TeamManagement(); |
|
| 22 | - $res = $tm->getUser($userId); |
|
| 23 | - print_r($res); |
|
| 21 | + $tm = new TeamManagement(); |
|
| 22 | + $res = $tm->getUser($userId); |
|
| 23 | + print_r($res); |
|
| 24 | 24 | } catch (ApiError $e) { |
| 25 | - echo 'Cannot get user with ID: ' . $userId . PHP_EOL; |
|
| 25 | + echo 'Cannot get user with ID: ' . $userId . PHP_EOL; |
|
| 26 | 26 | } |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
| 17 | 17 | |
| 18 | 18 | try { |
| 19 | - $tm = new TeamManagement(); |
|
| 20 | - $res = $tm->getUsers(); |
|
| 21 | - print_r($res); |
|
| 19 | + $tm = new TeamManagement(); |
|
| 20 | + $res = $tm->getUsers(); |
|
| 21 | + print_r($res); |
|
| 22 | 22 | } catch (ApiError $e) { |
| 23 | - echo $e->getMessage() . PHP_EOL; |
|
| 23 | + echo $e->getMessage() . PHP_EOL; |
|
| 24 | 24 | } |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | |
| 19 | 19 | $userId = 2565363; |
| 20 | 20 | $params = [ |
| 21 | - 'HIDE_ROUTED_ADDRESSES' => true, |
|
| 22 | - 'member_type' => 'SUB_ACCOUNT_DISPATCHER' |
|
| 21 | + 'HIDE_ROUTED_ADDRESSES' => true, |
|
| 22 | + 'member_type' => 'SUB_ACCOUNT_DISPATCHER' |
|
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | try { |
| 26 | - $tm = new TeamManagement(); |
|
| 27 | - $res = $tm->update($userId, $params); |
|
| 28 | - print_r($res); |
|
| 26 | + $tm = new TeamManagement(); |
|
| 27 | + $res = $tm->update($userId, $params); |
|
| 28 | + print_r($res); |
|
| 29 | 29 | } catch (ApiError $e) { |
| 30 | - echo $e->getMessage() . PHP_EOL; |
|
| 30 | + echo $e->getMessage() . PHP_EOL; |
|
| 31 | 31 | } |
@@ -19,51 +19,51 @@ |
||
| 19 | 19 | Route4Me::setApiKey(Constants::API_KEY); |
| 20 | 20 | |
| 21 | 21 | try { |
| 22 | - // get OWNER_MEMBER_ID |
|
| 23 | - $owner_member_id = null; |
|
| 24 | - $member = new Member(); |
|
| 25 | - $res_members = $member->getUsers(); |
|
| 22 | + // get OWNER_MEMBER_ID |
|
| 23 | + $owner_member_id = null; |
|
| 24 | + $member = new Member(); |
|
| 25 | + $res_members = $member->getUsers(); |
|
| 26 | 26 | |
| 27 | - if (is_array($res_members) && isset($res_members['results'])) { |
|
| 28 | - foreach ($res_members['results'] as $key => $value) { |
|
| 29 | - if ($value['OWNER_MEMBER_ID'] == 0) { |
|
| 30 | - $owner_member_id = $value['member_id']; |
|
| 31 | - break; |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - } |
|
| 27 | + if (is_array($res_members) && isset($res_members['results'])) { |
|
| 28 | + foreach ($res_members['results'] as $key => $value) { |
|
| 29 | + if ($value['OWNER_MEMBER_ID'] == 0) { |
|
| 30 | + $owner_member_id = $value['member_id']; |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - if (!$owner_member_id) { |
|
| 37 | - throw new Exception("Cannot find OWNER_MEMBER_ID."); |
|
| 38 | - } |
|
| 36 | + if (!$owner_member_id) { |
|
| 37 | + throw new Exception("Cannot find OWNER_MEMBER_ID."); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - // insert new sub-users |
|
| 41 | - $params = [ |
|
| 42 | - [ |
|
| 43 | - 'new_password' => '12345&Qwerty', |
|
| 44 | - 'member_first_name' => 'Tusha I', |
|
| 45 | - 'member_last_name' => 'Pupkindzes', |
|
| 46 | - 'member_email' => '[email protected]', |
|
| 47 | - 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 48 | - 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 49 | - ], [ |
|
| 50 | - 'new_password' => '12345&Qwerty', |
|
| 51 | - 'member_first_name' => 'Tusha II', |
|
| 52 | - 'member_last_name' => 'Pupkindzes', |
|
| 53 | - 'member_email' => '[email protected]', |
|
| 54 | - 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 55 | - 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 56 | - ] |
|
| 57 | - ]; |
|
| 40 | + // insert new sub-users |
|
| 41 | + $params = [ |
|
| 42 | + [ |
|
| 43 | + 'new_password' => '12345&Qwerty', |
|
| 44 | + 'member_first_name' => 'Tusha I', |
|
| 45 | + 'member_last_name' => 'Pupkindzes', |
|
| 46 | + 'member_email' => '[email protected]', |
|
| 47 | + 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 48 | + 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 49 | + ], [ |
|
| 50 | + 'new_password' => '12345&Qwerty', |
|
| 51 | + 'member_first_name' => 'Tusha II', |
|
| 52 | + 'member_last_name' => 'Pupkindzes', |
|
| 53 | + 'member_email' => '[email protected]', |
|
| 54 | + 'member_type' => 'SUB_ACCOUNT_DRIVER', |
|
| 55 | + 'OWNER_MEMBER_ID' => $owner_member_id |
|
| 56 | + ] |
|
| 57 | + ]; |
|
| 58 | 58 | |
| 59 | - $options = [ |
|
| 60 | - 'conflicts' => 'overwrite' |
|
| 61 | - ]; |
|
| 59 | + $options = [ |
|
| 60 | + 'conflicts' => 'overwrite' |
|
| 61 | + ]; |
|
| 62 | 62 | |
| 63 | - $tm = new TeamManagement(); |
|
| 64 | - $res = $tm->bulkInsert($params, $options); |
|
| 65 | - //print_r($res); |
|
| 66 | - echo "Insert two sub-users." . PHP_EOL; |
|
| 63 | + $tm = new TeamManagement(); |
|
| 64 | + $res = $tm->bulkInsert($params, $options); |
|
| 65 | + //print_r($res); |
|
| 66 | + echo "Insert two sub-users." . PHP_EOL; |
|
| 67 | 67 | } catch (Exception | ApiError $e) { |
| 68 | - echo $e->getMessage() . PHP_EOL; |
|
| 68 | + echo $e->getMessage() . PHP_EOL; |
|
| 69 | 69 | } |