diff --git a/src/Twilio/Rest/Assistants/V1/Assistant/FeedbackModels.php b/src/Twilio/Rest/Assistants/V1/Assistant/FeedbackModels.php index 0cef87598..c90f1c649 100644 --- a/src/Twilio/Rest/Assistants/V1/Assistant/FeedbackModels.php +++ b/src/Twilio/Rest/Assistants/V1/Assistant/FeedbackModels.php @@ -57,12 +57,19 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'message_id' => $this->messageId, - 'score' => $this->score, - 'session_id' => $this->sessionId, - 'text' => $this->text + $jsonString = [ + 'session_id' => $this->sessionId ]; + if (isset($this->messageId)) { + $jsonString['message_id'] = $this->messageId; + } + if (isset($this->score)) { + $jsonString['score'] = $this->score; + } + if (isset($this->text)) { + $jsonString['text'] = $this->text; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Assistants/V1/Assistant/MessageModels.php b/src/Twilio/Rest/Assistants/V1/Assistant/MessageModels.php index 06e040d67..87d1be9eb 100644 --- a/src/Twilio/Rest/Assistants/V1/Assistant/MessageModels.php +++ b/src/Twilio/Rest/Assistants/V1/Assistant/MessageModels.php @@ -61,13 +61,20 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'identity' => $this->identity, - 'session_id' => $this->sessionId, - 'body' => $this->body, - 'webhook' => $this->webhook, - 'mode' => $this->mode + 'body' => $this->body ]; + if (isset($this->sessionId)) { + $jsonString['session_id'] = $this->sessionId; + } + if (isset($this->webhook)) { + $jsonString['webhook'] = $this->webhook; + } + if (isset($this->mode)) { + $jsonString['mode'] = $this->mode; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Assistants/V1/AssistantModels.php b/src/Twilio/Rest/Assistants/V1/AssistantModels.php index c562988c1..4ab89ab53 100644 --- a/src/Twilio/Rest/Assistants/V1/AssistantModels.php +++ b/src/Twilio/Rest/Assistants/V1/AssistantModels.php @@ -83,10 +83,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'perception_engine_enabled' => $this->perceptionEngineEnabled, 'personalization_engine_enabled' => $this->personalizationEngineEnabled ]; + return $jsonString; } } @@ -113,11 +114,18 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'profile_api_key' => $this->profileApiKey, - 'space_id' => $this->spaceId, - 'write_key' => $this->writeKey + $jsonString = [ ]; + if (isset($this->profileApiKey)) { + $jsonString['profile_api_key'] = $this->profileApiKey; + } + if (isset($this->spaceId)) { + $jsonString['space_id'] = $this->spaceId; + } + if (isset($this->writeKey)) { + $jsonString['write_key'] = $this->writeKey; + } + return $jsonString; } } @@ -150,13 +158,22 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'customer_ai' => $this->customerAi, - 'name' => $this->name, - 'owner' => $this->owner, - 'personality_prompt' => $this->personalityPrompt, - 'segment_credential' => $this->segmentCredential + $jsonString = [ + 'name' => $this->name ]; + if (isset($this->customerAi)) { + $jsonString['customer_ai'] = $this->customerAi; + } + if (isset($this->owner)) { + $jsonString['owner'] = $this->owner; + } + if (isset($this->personalityPrompt)) { + $jsonString['personality_prompt'] = $this->personalityPrompt; + } + if (isset($this->segmentCredential)) { + $jsonString['segment_credential'] = $this->segmentCredential; + } + return $jsonString; } } @@ -189,13 +206,24 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'customer_ai' => $this->customerAi, - 'name' => $this->name, - 'owner' => $this->owner, - 'personality_prompt' => $this->personalityPrompt, - 'segment_credential' => $this->segmentCredential + $jsonString = [ ]; + if (isset($this->customerAi)) { + $jsonString['customer_ai'] = $this->customerAi; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->owner)) { + $jsonString['owner'] = $this->owner; + } + if (isset($this->personalityPrompt)) { + $jsonString['personality_prompt'] = $this->personalityPrompt; + } + if (isset($this->segmentCredential)) { + $jsonString['segment_credential'] = $this->segmentCredential; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Assistants/V1/KnowledgeModels.php b/src/Twilio/Rest/Assistants/V1/KnowledgeModels.php index e4ec4e2cb..f5e06962a 100644 --- a/src/Twilio/Rest/Assistants/V1/KnowledgeModels.php +++ b/src/Twilio/Rest/Assistants/V1/KnowledgeModels.php @@ -88,13 +88,22 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'description' => $this->description, - 'id' => $this->id, - 'name' => $this->name, - 'policy_details' => $this->policyDetails, - 'type' => $this->type + $jsonString = [ + 'policy_details' => $this->policyDetails ]; + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->type)) { + $jsonString['type'] = $this->type; + } + return $jsonString; } } @@ -133,15 +142,26 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'assistant_id' => $this->assistantId, - 'description' => $this->description, - 'knowledge_source_details' => $this->knowledgeSourceDetails, + $jsonString = [ 'name' => $this->name, - 'policy' => $this->policy, - 'type' => $this->type, - 'embedding_model' => $this->embeddingModel + 'type' => $this->type ]; + if (isset($this->assistantId)) { + $jsonString['assistant_id'] = $this->assistantId; + } + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->knowledgeSourceDetails)) { + $jsonString['knowledge_source_details'] = $this->knowledgeSourceDetails; + } + if (isset($this->policy)) { + $jsonString['policy'] = $this->policy; + } + if (isset($this->embeddingModel)) { + $jsonString['embedding_model'] = $this->embeddingModel; + } + return $jsonString; } } @@ -177,14 +197,27 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'description' => $this->description, - 'knowledge_source_details' => $this->knowledgeSourceDetails, - 'name' => $this->name, - 'policy' => $this->policy, - 'type' => $this->type, - 'embedding_model' => $this->embeddingModel + $jsonString = [ ]; + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->knowledgeSourceDetails)) { + $jsonString['knowledge_source_details'] = $this->knowledgeSourceDetails; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->policy)) { + $jsonString['policy'] = $this->policy; + } + if (isset($this->type)) { + $jsonString['type'] = $this->type; + } + if (isset($this->embeddingModel)) { + $jsonString['embedding_model'] = $this->embeddingModel; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Assistants/V1/ToolModels.php b/src/Twilio/Rest/Assistants/V1/ToolModels.php index 58e27f227..42a83cdf0 100644 --- a/src/Twilio/Rest/Assistants/V1/ToolModels.php +++ b/src/Twilio/Rest/Assistants/V1/ToolModels.php @@ -89,13 +89,22 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'description' => $this->description, - 'id' => $this->id, - 'name' => $this->name, - 'policy_details' => $this->policyDetails, - 'type' => $this->type + $jsonString = [ + 'policy_details' => $this->policyDetails ]; + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->type)) { + $jsonString['type'] = $this->type; + } + return $jsonString; } } @@ -134,15 +143,24 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'assistant_id' => $this->assistantId, - 'description' => $this->description, + $jsonString = [ 'enabled' => $this->enabled, - 'meta' => $this->meta, 'name' => $this->name, - 'policy' => $this->policy, 'type' => $this->type ]; + if (isset($this->assistantId)) { + $jsonString['assistant_id'] = $this->assistantId; + } + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->meta)) { + $jsonString['meta'] = $this->meta; + } + if (isset($this->policy)) { + $jsonString['policy'] = $this->policy; + } + return $jsonString; } } @@ -181,15 +199,30 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'assistant_id' => $this->assistantId, - 'description' => $this->description, - 'enabled' => $this->enabled, - 'meta' => $this->meta, - 'name' => $this->name, - 'policy' => $this->policy, - 'type' => $this->type + $jsonString = [ ]; + if (isset($this->assistantId)) { + $jsonString['assistant_id'] = $this->assistantId; + } + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->enabled)) { + $jsonString['enabled'] = $this->enabled; + } + if (isset($this->meta)) { + $jsonString['meta'] = $this->meta; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->policy)) { + $jsonString['policy'] = $this->policy; + } + if (isset($this->type)) { + $jsonString['type'] = $this->type; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Content/V1/Content/ApprovalCreateModels.php b/src/Twilio/Rest/Content/V1/Content/ApprovalCreateModels.php index c1581bb6a..5ea38d107 100644 --- a/src/Twilio/Rest/Content/V1/Content/ApprovalCreateModels.php +++ b/src/Twilio/Rest/Content/V1/Content/ApprovalCreateModels.php @@ -49,10 +49,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'name' => $this->name, 'category' => $this->category ]; + return $jsonString; } } diff --git a/src/Twilio/Rest/Content/V1/ContentModels.php b/src/Twilio/Rest/Content/V1/ContentModels.php index 43b6862fa..1cbae39e9 100644 --- a/src/Twilio/Rest/Content/V1/ContentModels.php +++ b/src/Twilio/Rest/Content/V1/ContentModels.php @@ -315,9 +315,10 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'body' => $this->body ]; + return $jsonString; } } @@ -341,10 +342,13 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'body' => $this->body, + $jsonString = [ 'media' => $this->media ]; + if (isset($this->body)) { + $jsonString['body'] = $this->body; + } + return $jsonString; } } @@ -377,13 +381,20 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'latitude' => $this->latitude, - 'longitude' => $this->longitude, - 'label' => $this->label, - 'id' => $this->id, - 'address' => $this->address + 'longitude' => $this->longitude ]; + if (isset($this->label)) { + $jsonString['label'] = $this->label; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->address)) { + $jsonString['address'] = $this->address; + } + return $jsonString; } } @@ -410,11 +421,14 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'id' => $this->id, - 'item' => $this->item, - 'description' => $this->description + 'item' => $this->item ]; + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + return $jsonString; } } @@ -441,11 +455,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'body' => $this->body, 'button' => $this->button, 'items' => $this->items ]; + return $jsonString; } } @@ -481,14 +496,23 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'type' => $this->type, - 'title' => $this->title, - 'url' => $this->url, - 'phone' => $this->phone, - 'code' => $this->code, - 'id' => $this->id + 'title' => $this->title ]; + if (isset($this->url)) { + $jsonString['url'] = $this->url; + } + if (isset($this->phone)) { + $jsonString['phone'] = $this->phone; + } + if (isset($this->code)) { + $jsonString['code'] = $this->code; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + return $jsonString; } } @@ -512,10 +536,15 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'body' => $this->body, - 'actions' => $this->actions + $jsonString = [ ]; + if (isset($this->body)) { + $jsonString['body'] = $this->body; + } + if (isset($this->actions)) { + $jsonString['actions'] = $this->actions; + } + return $jsonString; } } @@ -542,11 +571,14 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'type' => $this->type, - 'title' => $this->title, - 'id' => $this->id + 'title' => $this->title ]; + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + return $jsonString; } } @@ -570,10 +602,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'body' => $this->body, 'actions' => $this->actions ]; + return $jsonString; } } @@ -609,14 +642,23 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'type' => $this->type, - 'title' => $this->title, - 'url' => $this->url, - 'phone' => $this->phone, - 'id' => $this->id, - 'code' => $this->code + 'title' => $this->title ]; + if (isset($this->url)) { + $jsonString['url'] = $this->url; + } + if (isset($this->phone)) { + $jsonString['phone'] = $this->phone; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->code)) { + $jsonString['code'] = $this->code; + } + return $jsonString; } } @@ -646,12 +688,19 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'title' => $this->title, - 'subtitle' => $this->subtitle, - 'media' => $this->media, - 'actions' => $this->actions + $jsonString = [ + 'title' => $this->title ]; + if (isset($this->subtitle)) { + $jsonString['subtitle'] = $this->subtitle; + } + if (isset($this->media)) { + $jsonString['media'] = $this->media; + } + if (isset($this->actions)) { + $jsonString['actions'] = $this->actions; + } + return $jsonString; } } @@ -687,14 +736,27 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'id' => $this->id, - 'section_title' => $this->sectionTitle, - 'name' => $this->name, - 'media_url' => $this->mediaUrl, - 'price' => $this->price, - 'description' => $this->description + $jsonString = [ ]; + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->sectionTitle)) { + $jsonString['section_title'] = $this->sectionTitle; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->mediaUrl)) { + $jsonString['media_url'] = $this->mediaUrl; + } + if (isset($this->price)) { + $jsonString['price'] = $this->price; + } + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + return $jsonString; } } @@ -730,14 +792,25 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'title' => $this->title, - 'body' => $this->body, - 'subtitle' => $this->subtitle, - 'id' => $this->id, - 'items' => $this->items, - 'dynamic_items' => $this->dynamicItems + $jsonString = [ + 'body' => $this->body ]; + if (isset($this->title)) { + $jsonString['title'] = $this->title; + } + if (isset($this->subtitle)) { + $jsonString['subtitle'] = $this->subtitle; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->items)) { + $jsonString['items'] = $this->items; + } + if (isset($this->dynamicItems)) { + $jsonString['dynamic_items'] = $this->dynamicItems; + } + return $jsonString; } } @@ -770,13 +843,20 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'type' => $this->type, - 'title' => $this->title, - 'url' => $this->url, - 'phone' => $this->phone, - 'id' => $this->id + 'title' => $this->title ]; + if (isset($this->url)) { + $jsonString['url'] = $this->url; + } + if (isset($this->phone)) { + $jsonString['phone'] = $this->phone; + } + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + return $jsonString; } } @@ -806,12 +886,21 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'title' => $this->title, - 'body' => $this->body, - 'media' => $this->media, - 'actions' => $this->actions + $jsonString = [ ]; + if (isset($this->title)) { + $jsonString['title'] = $this->title; + } + if (isset($this->body)) { + $jsonString['body'] = $this->body; + } + if (isset($this->media)) { + $jsonString['media'] = $this->media; + } + if (isset($this->actions)) { + $jsonString['actions'] = $this->actions; + } + return $jsonString; } } @@ -835,10 +924,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'body' => $this->body, 'cards' => $this->cards ]; + return $jsonString; } } @@ -862,10 +952,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'label' => $this->label, 'type' => $this->type ]; + return $jsonString; } } @@ -898,13 +989,20 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'id' => $this->id, - 'next_page_id' => $this->nextPageId, - 'title' => $this->title, - 'subtitle' => $this->subtitle, 'layout' => $this->layout ]; + if (isset($this->nextPageId)) { + $jsonString['next_page_id'] = $this->nextPageId; + } + if (isset($this->title)) { + $jsonString['title'] = $this->title; + } + if (isset($this->subtitle)) { + $jsonString['subtitle'] = $this->subtitle; + } + return $jsonString; } } @@ -940,7 +1038,7 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'body' => $this->body, 'button_text' => $this->buttonText, 'subtitle' => $this->subtitle, @@ -948,6 +1046,7 @@ public function jsonSerialize(): array 'pages' => $this->pages, 'type' => $this->type ]; + return $jsonString; } } @@ -974,11 +1073,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'id' => $this->id, 'title' => $this->title, 'timeSlots' => $this->timeSlots ]; + return $jsonString; } } @@ -1011,13 +1111,22 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'body' => $this->body, - 'footer' => $this->footer, - 'media' => $this->media, - 'header_text' => $this->headerText, - 'actions' => $this->actions + $jsonString = [ + 'body' => $this->body ]; + if (isset($this->footer)) { + $jsonString['footer'] = $this->footer; + } + if (isset($this->media)) { + $jsonString['media'] = $this->media; + } + if (isset($this->headerText)) { + $jsonString['header_text'] = $this->headerText; + } + if (isset($this->actions)) { + $jsonString['actions'] = $this->actions; + } + return $jsonString; } } @@ -1041,10 +1150,11 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'type' => $this->type, 'copy_code_text' => $this->copyCodeText ]; + return $jsonString; } } @@ -1071,11 +1181,16 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'add_security_recommendation' => $this->addSecurityRecommendation, - 'code_expiration_minutes' => $this->codeExpirationMinutes, + $jsonString = [ 'actions' => $this->actions ]; + if (isset($this->addSecurityRecommendation)) { + $jsonString['add_security_recommendation'] = $this->addSecurityRecommendation; + } + if (isset($this->codeExpirationMinutes)) { + $jsonString['code_expiration_minutes'] = $this->codeExpirationMinutes; + } + return $jsonString; } } @@ -1132,21 +1247,48 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'twilio/text' => $this->twilioText, - 'twilio/media' => $this->twilioMedia, - 'twilio/location' => $this->twilioLocation, - 'twilio/list-picker' => $this->twilioListPicker, - 'twilio/call-to-action' => $this->twilioCallToAction, - 'twilio/quick-reply' => $this->twilioQuickReply, - 'twilio/card' => $this->twilioCard, - 'twilio/catalog' => $this->twilioCatalog, - 'twilio/carousel' => $this->twilioCarousel, - 'twilio/flows' => $this->twilioFlows, - 'twilio/schedule' => $this->twilioSchedule, - 'whatsapp/card' => $this->whatsappCard, - 'whatsapp/authentication' => $this->whatsappAuthentication + $jsonString = [ ]; + if (isset($this->twilioText)) { + $jsonString['twilio/text'] = $this->twilioText; + } + if (isset($this->twilioMedia)) { + $jsonString['twilio/media'] = $this->twilioMedia; + } + if (isset($this->twilioLocation)) { + $jsonString['twilio/location'] = $this->twilioLocation; + } + if (isset($this->twilioListPicker)) { + $jsonString['twilio/list-picker'] = $this->twilioListPicker; + } + if (isset($this->twilioCallToAction)) { + $jsonString['twilio/call-to-action'] = $this->twilioCallToAction; + } + if (isset($this->twilioQuickReply)) { + $jsonString['twilio/quick-reply'] = $this->twilioQuickReply; + } + if (isset($this->twilioCard)) { + $jsonString['twilio/card'] = $this->twilioCard; + } + if (isset($this->twilioCatalog)) { + $jsonString['twilio/catalog'] = $this->twilioCatalog; + } + if (isset($this->twilioCarousel)) { + $jsonString['twilio/carousel'] = $this->twilioCarousel; + } + if (isset($this->twilioFlows)) { + $jsonString['twilio/flows'] = $this->twilioFlows; + } + if (isset($this->twilioSchedule)) { + $jsonString['twilio/schedule'] = $this->twilioSchedule; + } + if (isset($this->whatsappCard)) { + $jsonString['whatsapp/card'] = $this->whatsappCard; + } + if (isset($this->whatsappAuthentication)) { + $jsonString['whatsapp/authentication'] = $this->whatsappAuthentication; + } + return $jsonString; } } @@ -1176,12 +1318,17 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'friendly_name' => $this->friendlyName, - 'variables' => $this->variables, + $jsonString = [ 'language' => $this->language, 'types' => $this->types ]; + if (isset($this->friendlyName)) { + $jsonString['friendly_name'] = $this->friendlyName; + } + if (isset($this->variables)) { + $jsonString['variables'] = $this->variables; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Lookups/V2/BucketModels.php b/src/Twilio/Rest/Lookups/V2/BucketModels.php index 6363db68e..4e016b2f0 100644 --- a/src/Twilio/Rest/Lookups/V2/BucketModels.php +++ b/src/Twilio/Rest/Lookups/V2/BucketModels.php @@ -49,10 +49,15 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'limit' => $this->limit, - 'ttl' => $this->ttl + $jsonString = [ ]; + if (isset($this->limit)) { + $jsonString['limit'] = $this->limit; + } + if (isset($this->ttl)) { + $jsonString['ttl'] = $this->ttl; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Lookups/V2/LookupOverrideModels.php b/src/Twilio/Rest/Lookups/V2/LookupOverrideModels.php index 66ac5918c..c7d2af1f2 100644 --- a/src/Twilio/Rest/Lookups/V2/LookupOverrideModels.php +++ b/src/Twilio/Rest/Lookups/V2/LookupOverrideModels.php @@ -49,10 +49,15 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'line_type' => $this->lineType, - 'reason' => $this->reason + $jsonString = [ ]; + if (isset($this->lineType)) { + $jsonString['line_type'] = $this->lineType; + } + if (isset($this->reason)) { + $jsonString['reason'] = $this->reason; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Lookups/V2/QueryModels.php b/src/Twilio/Rest/Lookups/V2/QueryModels.php index 33ad04486..5f151a32c 100644 --- a/src/Twilio/Rest/Lookups/V2/QueryModels.php +++ b/src/Twilio/Rest/Lookups/V2/QueryModels.php @@ -119,18 +119,39 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'first_name' => $this->firstName, - 'last_name' => $this->lastName, - 'address_line1' => $this->addressLine1, - 'address_line2' => $this->addressLine2, - 'city' => $this->city, - 'state' => $this->state, - 'postal_code' => $this->postalCode, - 'address_country_code' => $this->addressCountryCode, - 'national_id' => $this->nationalId, - 'date_of_birth' => $this->dateOfBirth + $jsonString = [ ]; + if (isset($this->firstName)) { + $jsonString['first_name'] = $this->firstName; + } + if (isset($this->lastName)) { + $jsonString['last_name'] = $this->lastName; + } + if (isset($this->addressLine1)) { + $jsonString['address_line1'] = $this->addressLine1; + } + if (isset($this->addressLine2)) { + $jsonString['address_line2'] = $this->addressLine2; + } + if (isset($this->city)) { + $jsonString['city'] = $this->city; + } + if (isset($this->state)) { + $jsonString['state'] = $this->state; + } + if (isset($this->postalCode)) { + $jsonString['postal_code'] = $this->postalCode; + } + if (isset($this->addressCountryCode)) { + $jsonString['address_country_code'] = $this->addressCountryCode; + } + if (isset($this->nationalId)) { + $jsonString['national_id'] = $this->nationalId; + } + if (isset($this->dateOfBirth)) { + $jsonString['date_of_birth'] = $this->dateOfBirth; + } + return $jsonString; } } @@ -151,9 +172,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'last_verified_date' => $this->lastVerifiedDate + $jsonString = [ ]; + if (isset($this->lastVerifiedDate)) { + $jsonString['last_verified_date'] = $this->lastVerifiedDate; + } + return $jsonString; } } @@ -174,9 +198,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'partner_sub_id' => $this->partnerSubId + $jsonString = [ ]; + if (isset($this->partnerSubId)) { + $jsonString['partner_sub_id'] = $this->partnerSubId; + } + return $jsonString; } } @@ -215,15 +242,28 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'correlation_id' => $this->correlationId, - 'phone_number' => $this->phoneNumber, - 'fields' => $this->fields, - 'country_code' => $this->countryCode, - 'identity_match' => $this->identityMatch, - 'reassigned_number' => $this->reassignedNumber, - 'sms_pumping_risk' => $this->smsPumpingRisk + $jsonString = [ + 'phone_number' => $this->phoneNumber ]; + if (isset($this->correlationId)) { + $jsonString['correlation_id'] = $this->correlationId; + } + if (isset($this->fields)) { + $jsonString['fields'] = $this->fields; + } + if (isset($this->countryCode)) { + $jsonString['country_code'] = $this->countryCode; + } + if (isset($this->identityMatch)) { + $jsonString['identity_match'] = $this->identityMatch; + } + if (isset($this->reassignedNumber)) { + $jsonString['reassigned_number'] = $this->reassignedNumber; + } + if (isset($this->smsPumpingRisk)) { + $jsonString['sms_pumping_risk'] = $this->smsPumpingRisk; + } + return $jsonString; } } @@ -244,9 +284,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'phone_numbers' => $this->phoneNumbers + $jsonString = [ ]; + if (isset($this->phoneNumbers)) { + $jsonString['phone_numbers'] = $this->phoneNumbers; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Marketplace/V1/InstalledAddOn/InstalledAddOnUsageModels.php b/src/Twilio/Rest/Marketplace/V1/InstalledAddOn/InstalledAddOnUsageModels.php index fdb026ad1..ef24e74f4 100644 --- a/src/Twilio/Rest/Marketplace/V1/InstalledAddOn/InstalledAddOnUsageModels.php +++ b/src/Twilio/Rest/Marketplace/V1/InstalledAddOn/InstalledAddOnUsageModels.php @@ -62,11 +62,14 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'quantity' => $this->quantity, - 'sid' => $this->sid, - 'submitted' => $this->submitted + 'sid' => $this->sid ]; + if (isset($this->submitted)) { + $jsonString['submitted'] = $this->submitted; + } + return $jsonString; } } @@ -90,10 +93,13 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'total_submitted' => $this->totalSubmitted, + $jsonString = [ 'billable_items' => $this->billableItems ]; + if (isset($this->totalSubmitted)) { + $jsonString['total_submitted'] = $this->totalSubmitted; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Marketplace/V1/ReferralConversionModels.php b/src/Twilio/Rest/Marketplace/V1/ReferralConversionModels.php index cabac010c..6fbc0abf8 100644 --- a/src/Twilio/Rest/Marketplace/V1/ReferralConversionModels.php +++ b/src/Twilio/Rest/Marketplace/V1/ReferralConversionModels.php @@ -45,9 +45,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'referral_account_sid' => $this->referralAccountSid + $jsonString = [ ]; + if (isset($this->referralAccountSid)) { + $jsonString['referral_account_sid'] = $this->referralAccountSid; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/Messaging/V2/ChannelsSenderModels.php b/src/Twilio/Rest/Messaging/V2/ChannelsSenderModels.php index ba55d047e..78d533678 100644 --- a/src/Twilio/Rest/Messaging/V2/ChannelsSenderModels.php +++ b/src/Twilio/Rest/Messaging/V2/ChannelsSenderModels.php @@ -106,12 +106,21 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'waba_id' => $this->wabaId, - 'verification_method' => $this->verificationMethod, - 'verification_code' => $this->verificationCode, - 'voice_application_sid' => $this->voiceApplicationSid + $jsonString = [ ]; + if (isset($this->wabaId)) { + $jsonString['waba_id'] = $this->wabaId; + } + if (isset($this->verificationMethod)) { + $jsonString['verification_method'] = $this->verificationMethod; + } + if (isset($this->verificationCode)) { + $jsonString['verification_code'] = $this->verificationCode; + } + if (isset($this->voiceApplicationSid)) { + $jsonString['voice_application_sid'] = $this->voiceApplicationSid; + } + return $jsonString; } } @@ -147,14 +156,27 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'callback_url' => $this->callbackUrl, - 'callback_method' => $this->callbackMethod, - 'fallback_url' => $this->fallbackUrl, - 'fallback_method' => $this->fallbackMethod, - 'status_callback_url' => $this->statusCallbackUrl, - 'status_callback_method' => $this->statusCallbackMethod + $jsonString = [ ]; + if (isset($this->callbackUrl)) { + $jsonString['callback_url'] = $this->callbackUrl; + } + if (isset($this->callbackMethod)) { + $jsonString['callback_method'] = $this->callbackMethod; + } + if (isset($this->fallbackUrl)) { + $jsonString['fallback_url'] = $this->fallbackUrl; + } + if (isset($this->fallbackMethod)) { + $jsonString['fallback_method'] = $this->fallbackMethod; + } + if (isset($this->statusCallbackUrl)) { + $jsonString['status_callback_url'] = $this->statusCallbackUrl; + } + if (isset($this->statusCallbackMethod)) { + $jsonString['status_callback_method'] = $this->statusCallbackMethod; + } + return $jsonString; } } @@ -196,16 +218,33 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'name' => $this->name, - 'about' => $this->about, - 'address' => $this->address, - 'description' => $this->description, - 'emails' => $this->emails, - 'logo_url' => $this->logoUrl, - 'vertical' => $this->vertical, - 'websites' => $this->websites + $jsonString = [ ]; + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->about)) { + $jsonString['about'] = $this->about; + } + if (isset($this->address)) { + $jsonString['address'] = $this->address; + } + if (isset($this->description)) { + $jsonString['description'] = $this->description; + } + if (isset($this->emails)) { + $jsonString['emails'] = $this->emails; + } + if (isset($this->logoUrl)) { + $jsonString['logo_url'] = $this->logoUrl; + } + if (isset($this->vertical)) { + $jsonString['vertical'] = $this->vertical; + } + if (isset($this->websites)) { + $jsonString['websites'] = $this->websites; + } + return $jsonString; } } @@ -235,12 +274,19 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'sender_id' => $this->senderId, - 'configuration' => $this->configuration, - 'webhook' => $this->webhook, - 'profile' => $this->profile + $jsonString = [ + 'sender_id' => $this->senderId ]; + if (isset($this->configuration)) { + $jsonString['configuration'] = $this->configuration; + } + if (isset($this->webhook)) { + $jsonString['webhook'] = $this->webhook; + } + if (isset($this->profile)) { + $jsonString['profile'] = $this->profile; + } + return $jsonString; } } @@ -267,11 +313,18 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'configuration' => $this->configuration, - 'webhook' => $this->webhook, - 'profile' => $this->profile + $jsonString = [ ]; + if (isset($this->configuration)) { + $jsonString['configuration'] = $this->configuration; + } + if (isset($this->webhook)) { + $jsonString['webhook'] = $this->webhook; + } + if (isset($this->profile)) { + $jsonString['profile'] = $this->profile; + } + return $jsonString; } } diff --git a/src/Twilio/Rest/PreviewIam/Versionless/Organization/RoleAssignmentModels.php b/src/Twilio/Rest/PreviewIam/Versionless/Organization/RoleAssignmentModels.php index 0e58cdad1..5e89365cb 100644 --- a/src/Twilio/Rest/PreviewIam/Versionless/Organization/RoleAssignmentModels.php +++ b/src/Twilio/Rest/PreviewIam/Versionless/Organization/RoleAssignmentModels.php @@ -53,11 +53,12 @@ public function toArray(): array public function jsonSerialize(): array { - return [ + $jsonString = [ 'role_sid' => $this->roleSid, 'scope' => $this->scope, 'identity' => $this->identity ]; + return $jsonString; } } diff --git a/src/Twilio/Rest/PreviewIam/Versionless/Organization/UserModels.php b/src/Twilio/Rest/PreviewIam/Versionless/Organization/UserModels.php index a6b048d9c..aedcc0179 100644 --- a/src/Twilio/Rest/PreviewIam/Versionless/Organization/UserModels.php +++ b/src/Twilio/Rest/PreviewIam/Versionless/Organization/UserModels.php @@ -88,10 +88,15 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'givenName' => $this->givenName, - 'familyName' => $this->familyName + $jsonString = [ ]; + if (isset($this->givenName)) { + $jsonString['givenName'] = $this->givenName; + } + if (isset($this->familyName)) { + $jsonString['familyName'] = $this->familyName; + } + return $jsonString; } } @@ -118,11 +123,18 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'primary' => $this->primary, - 'value' => $this->value, - 'type' => $this->type + $jsonString = [ ]; + if (isset($this->primary)) { + $jsonString['primary'] = $this->primary; + } + if (isset($this->value)) { + $jsonString['value'] = $this->value; + } + if (isset($this->type)) { + $jsonString['type'] = $this->type; + } + return $jsonString; } } @@ -152,12 +164,21 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'resourceType' => $this->resourceType, - 'created' => $this->created, - 'lastModified' => $this->lastModified, - 'version' => $this->version + $jsonString = [ ]; + if (isset($this->resourceType)) { + $jsonString['resourceType'] = $this->resourceType; + } + if (isset($this->created)) { + $jsonString['created'] = $this->created; + } + if (isset($this->lastModified)) { + $jsonString['lastModified'] = $this->lastModified; + } + if (isset($this->version)) { + $jsonString['version'] = $this->version; + } + return $jsonString; } } @@ -208,19 +229,40 @@ public function toArray(): array public function jsonSerialize(): array { - return [ - 'id' => $this->id, - 'externalId' => $this->externalId, - 'userName' => $this->userName, - 'displayName' => $this->displayName, - 'name' => $this->name, - 'emails' => $this->emails, - 'active' => $this->active, - 'locale' => $this->locale, - 'timezone' => $this->timezone, - 'schemas' => $this->schemas, - 'meta' => $this->meta + $jsonString = [ + 'userName' => $this->userName ]; + if (isset($this->id)) { + $jsonString['id'] = $this->id; + } + if (isset($this->externalId)) { + $jsonString['externalId'] = $this->externalId; + } + if (isset($this->displayName)) { + $jsonString['displayName'] = $this->displayName; + } + if (isset($this->name)) { + $jsonString['name'] = $this->name; + } + if (isset($this->emails)) { + $jsonString['emails'] = $this->emails; + } + if (isset($this->active)) { + $jsonString['active'] = $this->active; + } + if (isset($this->locale)) { + $jsonString['locale'] = $this->locale; + } + if (isset($this->timezone)) { + $jsonString['timezone'] = $this->timezone; + } + if (isset($this->schemas)) { + $jsonString['schemas'] = $this->schemas; + } + if (isset($this->meta)) { + $jsonString['meta'] = $this->meta; + } + return $jsonString; } }