|
@@ 139-145 (lines=7) @@
|
| 136 |
|
return json_decode($response->getBody(), true); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
public function getBasicInformation(string $objectName) |
| 140 |
|
{ |
| 141 |
|
$url = sprintf('%s%s/%s', $this->getBaseUrl(), static::BASE_API_URL, $objectName); |
| 142 |
|
$response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization()); |
| 143 |
|
|
| 144 |
|
return json_decode($response->getBody(), true); |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
public function getDescribedObject(string $objectName) |
| 148 |
|
{ |
|
@@ 147-158 (lines=12) @@
|
| 144 |
|
return json_decode($response->getBody(), true); |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
public function getDescribedObject(string $objectName) |
| 148 |
|
{ |
| 149 |
|
$url = sprintf( |
| 150 |
|
'%s%s/%s/describe', |
| 151 |
|
$this->getBaseUrl(), |
| 152 |
|
static::BASE_API_URL, |
| 153 |
|
$objectName |
| 154 |
|
); |
| 155 |
|
$response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization()); |
| 156 |
|
|
| 157 |
|
return json_decode($response->getBody(), true); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
public function findById($objectName, $objectId, array $fields = []) |
| 161 |
|
{ |
|
@@ 160-173 (lines=14) @@
|
| 157 |
|
return json_decode($response->getBody(), true); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
public function findById($objectName, $objectId, array $fields = []) |
| 161 |
|
{ |
| 162 |
|
$url = sprintf( |
| 163 |
|
'%s%s/%s/%s?fields=%s', |
| 164 |
|
$this->getBaseUrl(), |
| 165 |
|
static::BASE_API_URL, |
| 166 |
|
$objectName, |
| 167 |
|
$objectId, |
| 168 |
|
implode(',', $fields) |
| 169 |
|
); |
| 170 |
|
$response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization()); |
| 171 |
|
|
| 172 |
|
return json_decode($response->getBody(), true); |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
public function insert($objectName, array $data = []) |
| 176 |
|
{ |
|
@@ 175-181 (lines=7) @@
|
| 172 |
|
return json_decode($response->getBody(), true); |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
public function insert($objectName, array $data = []) |
| 176 |
|
{ |
| 177 |
|
$url = sprintf('%s%s/%s/', $this->getBaseUrl(), static::BASE_API_URL, $objectName); |
| 178 |
|
$response = $this->request(HttpWords::POST, $url, $this->getHeaderWithAuthorizationAndData($data)); |
| 179 |
|
|
| 180 |
|
return json_decode($response->getBody(), true); |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
public function upsertByExternalId( |
| 184 |
|
string $objectName, |
|
@@ 183-200 (lines=18) @@
|
| 180 |
|
return json_decode($response->getBody(), true); |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
public function upsertByExternalId( |
| 184 |
|
string $objectName, |
| 185 |
|
string $externalIdName, |
| 186 |
|
string $externalIdValue, |
| 187 |
|
array $data = [] |
| 188 |
|
) { |
| 189 |
|
$url = sprintf( |
| 190 |
|
'%s%s/%s/%s/%s', |
| 191 |
|
$this->getBaseUrl(), |
| 192 |
|
static::BASE_API_URL, |
| 193 |
|
$objectName, |
| 194 |
|
$externalIdName, |
| 195 |
|
$externalIdValue |
| 196 |
|
); |
| 197 |
|
$response = $this->request(HttpWords::PATCH, $url, $this->getHeaderWithAuthorizationAndData($data)); |
| 198 |
|
|
| 199 |
|
return json_decode($response->getBody(), true); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
public function update($objectName, $objectId, $data = []) |
| 203 |
|
{ |
|
@@ 202-214 (lines=13) @@
|
| 199 |
|
return json_decode($response->getBody(), true); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
public function update($objectName, $objectId, $data = []) |
| 203 |
|
{ |
| 204 |
|
$url = sprintf( |
| 205 |
|
'%s%s/%s/%s', |
| 206 |
|
$this->getBaseUrl(), |
| 207 |
|
static::BASE_API_URL, |
| 208 |
|
$objectName, |
| 209 |
|
$objectId |
| 210 |
|
); |
| 211 |
|
$response = $this->request(HttpWords::PATCH, $url, $this->getHeaderWithAuthorizationAndData($data)); |
| 212 |
|
|
| 213 |
|
return json_decode($response->getBody(), true); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
public function delete($objectName, $objectId) |
| 217 |
|
{ |