solution = [ 'serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'key' => $key, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) .'/Maps/' . \rawurlencode($mapSid) .'/Items/' . \rawurlencode($key) .''; } /** * Delete the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch']]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the SyncMapItemInstance * * @return SyncMapItemInstance Fetched SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapItemInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Update the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Updated SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncMapItemInstance { $options = new Values($options); $data = Values::of([ 'Data' => Serialize::jsonObject($options['data']), 'Ttl' => $options['ttl'], 'ItemTtl' => $options['itemTtl'], 'CollectionTtl' => $options['collectionTtl'], ]); $headers = Values::of(['If-Match' => $options['ifMatch']]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapItemContext ' . \implode(' ', $context) . ']'; } }