solution = [ 'serviceSid' => $serviceSid, 'documentSid' => $documentSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) .'/Documents/' . \rawurlencode($documentSid) .'/Permissions/' . \rawurlencode($identity) .''; } /** * Delete the DocumentPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the DocumentPermissionInstance * * @return DocumentPermissionInstance Fetched DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * Update the DocumentPermissionInstance * * @param bool $read Boolean flag specifying whether the identity can read the Sync Document. * @param bool $write Boolean flag specifying whether the identity can update the Sync Document. * @param bool $manage Boolean flag specifying whether the identity can delete the Sync Document. * @return DocumentPermissionInstance Updated DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): DocumentPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * 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.Preview.Sync.DocumentPermissionContext ' . \implode(' ', $context) . ']'; } }