@@ 172-185 (lines=14) @@ | ||
169 | * @param $params |
|
170 | * @throws SalesforceException |
|
171 | */ |
|
172 | public function update(string $id, array $params) |
|
173 | { |
|
174 | $response = $this->sendRequest('PATCH', "/sobjects/" . $this->getType() . "/$id", |
|
175 | [ |
|
176 | 'json' => $params, |
|
177 | ] |
|
178 | ); |
|
179 | ||
180 | if ($response->success !== true) { |
|
181 | throw new SalesforceException($response->errors); |
|
182 | } |
|
183 | ||
184 | return $response; |
|
185 | } |
|
186 | ||
187 | /** |
|
188 | * Insert new account. |
|
@@ 194-205 (lines=12) @@ | ||
191 | * |
|
192 | * @throws SalesforceException |
|
193 | */ |
|
194 | public function create(array $params) |
|
195 | { |
|
196 | $response = $this->sendRequest('POST', "/sobject/" . $this->getType(), [ |
|
197 | 'json' => $params, |
|
198 | ]); |
|
199 | ||
200 | if ($response->success !== true) { |
|
201 | throw new SalesforceException($response->errors); |
|
202 | } |
|
203 | ||
204 | return $response; |
|
205 | } |
|
206 | ||
207 | /** |
|
208 | * Delete a given record |
|
@@ 213-222 (lines=10) @@ | ||
210 | * @param string $id |
|
211 | * @throws SalesforceException |
|
212 | */ |
|
213 | public function delete(string $id) |
|
214 | { |
|
215 | $response = $this->sendRequest('DELETE', "/sobjects/" . $this->getType() . "/$id"); |
|
216 | ||
217 | if ($response->success !== true) { |
|
218 | throw new SalesforceException($response->errors); |
|
219 | } |
|
220 | ||
221 | return $response; |
|
222 | } |
|
223 | } |
|
224 |