properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'type' => Values::array_get($payload, 'type'), 'schemaVersion' => Values::array_get($payload, 'schema_version'), 'subscriptionSid' => Values::array_get($payload, 'subscription_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['subscriptionSid' => $subscriptionSid, 'type' => $type ?: $this->properties['type'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SubscribedEventContext Context for this SubscribedEventInstance */ protected function proxy(): SubscribedEventContext { if (!$this->context) { $this->context = new SubscribedEventContext( $this->version, $this->solution['subscriptionSid'], $this->solution['type'] ); } return $this->context; } /** * Delete the SubscribedEventInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the SubscribedEventInstance * * @return SubscribedEventInstance Fetched SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribedEventInstance { return $this->proxy()->fetch(); } /** * Update the SubscribedEventInstance * * @param array|Options $options Optional Arguments * @return SubscribedEventInstance Updated SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscribedEventInstance { return $this->proxy()->update($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $name) { if (\array_key_exists($name, $this->properties)) { return $this->properties[$name]; } if (\property_exists($this, '_' . $name)) { $method = 'get' . \ucfirst($name); return $this->$method(); } throw new TwilioException('Unknown property: ' . $name); } /** * 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.Events.V1.SubscribedEventInstance ' . \implode(' ', $context) . ']'; } }