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