diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9f1681c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 00000000..a041b5fa --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,676 @@ +.gitignore +.openapi-generator-ignore +.php-cs-fixer.dist.php +.travis.yml +README.md +composer.json +docs/Api/AliasControllerApi.md +docs/Api/ApiUserControllerApi.md +docs/Api/AttachmentControllerApi.md +docs/Api/BounceControllerApi.md +docs/Api/BulkActionsControllerApi.md +docs/Api/CommonActionsControllerApi.md +docs/Api/ContactControllerApi.md +docs/Api/DomainControllerApi.md +docs/Api/EmailControllerApi.md +docs/Api/EmailVerificationControllerApi.md +docs/Api/ExpiredControllerApi.md +docs/Api/ExportControllerApi.md +docs/Api/FormControllerApi.md +docs/Api/GroupControllerApi.md +docs/Api/InboxControllerApi.md +docs/Api/InboxForwarderControllerApi.md +docs/Api/InboxRulesetControllerApi.md +docs/Api/MailServerControllerApi.md +docs/Api/MissedEmailControllerApi.md +docs/Api/PhoneControllerApi.md +docs/Api/SentEmailsControllerApi.md +docs/Api/SmsControllerApi.md +docs/Api/TemplateControllerApi.md +docs/Api/TrackingControllerApi.md +docs/Api/WaitForControllerApi.md +docs/Api/WebhookControllerApi.md +docs/Model/AbstractWebhookPayload.md +docs/Model/AliasDto.md +docs/Model/AliasProjection.md +docs/Model/AttachmentEntity.md +docs/Model/AttachmentMetaData.md +docs/Model/AttachmentProjection.md +docs/Model/BasicAuthOptions.md +docs/Model/BounceProjection.md +docs/Model/BounceRecipientProjection.md +docs/Model/BouncedEmailDto.md +docs/Model/BouncedRecipientDto.md +docs/Model/BulkSendEmailOptions.md +docs/Model/Complaint.md +docs/Model/ConditionOption.md +docs/Model/ContactDto.md +docs/Model/ContactProjection.md +docs/Model/ContentMatchOptions.md +docs/Model/CountDto.md +docs/Model/CreateAliasOptions.md +docs/Model/CreateContactOptions.md +docs/Model/CreateDomainOptions.md +docs/Model/CreateEmergencyAddressOptions.md +docs/Model/CreateGroupOptions.md +docs/Model/CreateInboxDto.md +docs/Model/CreateInboxForwarderOptions.md +docs/Model/CreateInboxRulesetOptions.md +docs/Model/CreateTemplateOptions.md +docs/Model/CreateTrackingPixelOptions.md +docs/Model/CreateWebhookOptions.md +docs/Model/DNSLookupOptions.md +docs/Model/DNSLookupResult.md +docs/Model/DNSLookupResults.md +docs/Model/DeliveryStatusDto.md +docs/Model/DescribeDomainOptions.md +docs/Model/DescribeMailServerDomainResult.md +docs/Model/DomainDto.md +docs/Model/DomainNameRecord.md +docs/Model/DomainPreview.md +docs/Model/DownloadAttachmentDto.md +docs/Model/Email.md +docs/Model/EmailAnalysis.md +docs/Model/EmailContentMatchResult.md +docs/Model/EmailHtmlDto.md +docs/Model/EmailLinksResult.md +docs/Model/EmailPreview.md +docs/Model/EmailPreviewUrls.md +docs/Model/EmailProjection.md +docs/Model/EmailRecipients.md +docs/Model/EmailTextLinesResult.md +docs/Model/EmailValidationRequestDto.md +docs/Model/EmailVerificationResult.md +docs/Model/EmergencyAddress.md +docs/Model/EmergencyAddressDto.md +docs/Model/EmptyResponseDto.md +docs/Model/ExpirationDefaults.md +docs/Model/ExpiredInboxDto.md +docs/Model/ExpiredInboxRecordProjection.md +docs/Model/ExportLink.md +docs/Model/ExportOptions.md +docs/Model/FilterBouncedRecipientsOptions.md +docs/Model/FilterBouncedRecipientsResult.md +docs/Model/FlushExpiredInboxesResult.md +docs/Model/ForwardEmailOptions.md +docs/Model/GravatarUrl.md +docs/Model/GroupContactsDto.md +docs/Model/GroupDto.md +docs/Model/GroupProjection.md +docs/Model/HTMLValidationResult.md +docs/Model/IPAddressResult.md +docs/Model/ImapFlagOperationOptions.md +docs/Model/ImapSmtpAccessDetails.md +docs/Model/InboxByEmailAddressResult.md +docs/Model/InboxByNameResult.md +docs/Model/InboxDto.md +docs/Model/InboxExistsDto.md +docs/Model/InboxForwarderDto.md +docs/Model/InboxForwarderEventProjection.md +docs/Model/InboxForwarderTestOptions.md +docs/Model/InboxForwarderTestResult.md +docs/Model/InboxIdItem.md +docs/Model/InboxIdsResult.md +docs/Model/InboxPreview.md +docs/Model/InboxRulesetDto.md +docs/Model/InboxRulesetTestOptions.md +docs/Model/InboxRulesetTestResult.md +docs/Model/JSONSchemaDto.md +docs/Model/ListUnsubscribeRecipientProjection.md +docs/Model/MatchOption.md +docs/Model/MatchOptions.md +docs/Model/MissedEmailDto.md +docs/Model/MissedEmailProjection.md +docs/Model/NameServerRecord.md +docs/Model/OrganizationInboxProjection.md +docs/Model/PageAlias.md +docs/Model/PageAttachmentEntity.md +docs/Model/PageBouncedEmail.md +docs/Model/PageBouncedRecipients.md +docs/Model/PageComplaint.md +docs/Model/PageContactProjection.md +docs/Model/PageDeliveryStatus.md +docs/Model/PageEmailPreview.md +docs/Model/PageEmailProjection.md +docs/Model/PageEmailValidationRequest.md +docs/Model/PageExpiredInboxRecordProjection.md +docs/Model/PageGroupProjection.md +docs/Model/PageInboxForwarderDto.md +docs/Model/PageInboxForwarderEvents.md +docs/Model/PageInboxProjection.md +docs/Model/PageInboxRulesetDto.md +docs/Model/PageListUnsubscribeRecipients.md +docs/Model/PageMissedEmailProjection.md +docs/Model/PageOrganizationInboxProjection.md +docs/Model/PagePhoneNumberProjection.md +docs/Model/PageScheduledJobs.md +docs/Model/PageSentEmailProjection.md +docs/Model/PageSentEmailWithQueueProjection.md +docs/Model/PageSmsProjection.md +docs/Model/PageTemplateProjection.md +docs/Model/PageThreadProjection.md +docs/Model/PageTrackingPixelProjection.md +docs/Model/PageUnknownMissedEmailProjection.md +docs/Model/PageWebhookProjection.md +docs/Model/PageWebhookResult.md +docs/Model/PageableObject.md +docs/Model/PhoneNumberDto.md +docs/Model/PhoneNumberProjection.md +docs/Model/PhonePlanDto.md +docs/Model/RawEmailJson.md +docs/Model/Recipient.md +docs/Model/ReplyToAliasEmailOptions.md +docs/Model/ReplyToEmailOptions.md +docs/Model/ScheduledJob.md +docs/Model/ScheduledJobDto.md +docs/Model/SendEmailOptions.md +docs/Model/SendSMTPEnvelopeOptions.md +docs/Model/SendWithQueueResult.md +docs/Model/Sender.md +docs/Model/SentEmailDto.md +docs/Model/SentEmailProjection.md +docs/Model/SetInboxFavouritedOptions.md +docs/Model/SimpleSendEmailOptions.md +docs/Model/SmsDto.md +docs/Model/SmsMatchOption.md +docs/Model/SmsPreview.md +docs/Model/SmsProjection.md +docs/Model/Sort.md +docs/Model/TemplateDto.md +docs/Model/TemplatePreview.md +docs/Model/TemplateProjection.md +docs/Model/TemplateVariable.md +docs/Model/TestNewInboxForwarderOptions.md +docs/Model/TestNewInboxRulesetOptions.md +docs/Model/TestPhoneNumberOptions.md +docs/Model/ThreadProjection.md +docs/Model/TrackingPixelDto.md +docs/Model/TrackingPixelProjection.md +docs/Model/UnknownMissedEmailProjection.md +docs/Model/UnreadCount.md +docs/Model/UnseenErrorCountDto.md +docs/Model/UpdateAliasOptions.md +docs/Model/UpdateDomainOptions.md +docs/Model/UpdateGroupContacts.md +docs/Model/UpdateInboxOptions.md +docs/Model/UploadAttachmentBytesRequest.md +docs/Model/UploadAttachmentOptions.md +docs/Model/UploadMultipartFormRequest.md +docs/Model/UserInfoDto.md +docs/Model/ValidateEmailAddressListOptions.md +docs/Model/ValidateEmailAddressListResult.md +docs/Model/ValidationDto.md +docs/Model/ValidationMessage.md +docs/Model/VerifyEmailAddressOptions.md +docs/Model/VerifyWebhookSignatureOptions.md +docs/Model/VerifyWebhookSignatureResults.md +docs/Model/WaitForConditions.md +docs/Model/WaitForSingleSmsOptions.md +docs/Model/WaitForSmsConditions.md +docs/Model/WebhookBouncePayload.md +docs/Model/WebhookBounceRecipientPayload.md +docs/Model/WebhookDeliveryStatusPayload.md +docs/Model/WebhookDto.md +docs/Model/WebhookEmailOpenedPayload.md +docs/Model/WebhookEmailReadPayload.md +docs/Model/WebhookHeaderNameValue.md +docs/Model/WebhookHeaders.md +docs/Model/WebhookNewAttachmentPayload.md +docs/Model/WebhookNewContactPayload.md +docs/Model/WebhookNewEmailPayload.md +docs/Model/WebhookNewSmsPayload.md +docs/Model/WebhookProjection.md +docs/Model/WebhookRedriveResult.md +docs/Model/WebhookResultDto.md +docs/Model/WebhookTestRequest.md +docs/Model/WebhookTestResponse.md +docs/Model/WebhookTestResult.md +git_push.sh +lib/ApiException.php +lib/Apis/AliasControllerApi.php +lib/Apis/ApiUserControllerApi.php +lib/Apis/AttachmentControllerApi.php +lib/Apis/BounceControllerApi.php +lib/Apis/BulkActionsControllerApi.php +lib/Apis/CommonActionsControllerApi.php +lib/Apis/ContactControllerApi.php +lib/Apis/DomainControllerApi.php +lib/Apis/EmailControllerApi.php +lib/Apis/EmailVerificationControllerApi.php +lib/Apis/ExpiredControllerApi.php +lib/Apis/ExportControllerApi.php +lib/Apis/FormControllerApi.php +lib/Apis/GroupControllerApi.php +lib/Apis/InboxControllerApi.php +lib/Apis/InboxForwarderControllerApi.php +lib/Apis/InboxRulesetControllerApi.php +lib/Apis/MailServerControllerApi.php +lib/Apis/MissedEmailControllerApi.php +lib/Apis/PhoneControllerApi.php +lib/Apis/SentEmailsControllerApi.php +lib/Apis/SmsControllerApi.php +lib/Apis/TemplateControllerApi.php +lib/Apis/TrackingControllerApi.php +lib/Apis/WaitForControllerApi.php +lib/Apis/WebhookControllerApi.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Models/AbstractWebhookPayload.php +lib/Models/AliasDto.php +lib/Models/AliasProjection.php +lib/Models/AttachmentEntity.php +lib/Models/AttachmentMetaData.php +lib/Models/AttachmentProjection.php +lib/Models/BasicAuthOptions.php +lib/Models/BounceProjection.php +lib/Models/BounceRecipientProjection.php +lib/Models/BouncedEmailDto.php +lib/Models/BouncedRecipientDto.php +lib/Models/BulkSendEmailOptions.php +lib/Models/Complaint.php +lib/Models/ConditionOption.php +lib/Models/ContactDto.php +lib/Models/ContactProjection.php +lib/Models/ContentMatchOptions.php +lib/Models/CountDto.php +lib/Models/CreateAliasOptions.php +lib/Models/CreateContactOptions.php +lib/Models/CreateDomainOptions.php +lib/Models/CreateEmergencyAddressOptions.php +lib/Models/CreateGroupOptions.php +lib/Models/CreateInboxDto.php +lib/Models/CreateInboxForwarderOptions.php +lib/Models/CreateInboxRulesetOptions.php +lib/Models/CreateTemplateOptions.php +lib/Models/CreateTrackingPixelOptions.php +lib/Models/CreateWebhookOptions.php +lib/Models/DNSLookupOptions.php +lib/Models/DNSLookupResult.php +lib/Models/DNSLookupResults.php +lib/Models/DeliveryStatusDto.php +lib/Models/DescribeDomainOptions.php +lib/Models/DescribeMailServerDomainResult.php +lib/Models/DomainDto.php +lib/Models/DomainNameRecord.php +lib/Models/DomainPreview.php +lib/Models/DownloadAttachmentDto.php +lib/Models/Email.php +lib/Models/EmailAnalysis.php +lib/Models/EmailContentMatchResult.php +lib/Models/EmailHtmlDto.php +lib/Models/EmailLinksResult.php +lib/Models/EmailPreview.php +lib/Models/EmailPreviewUrls.php +lib/Models/EmailProjection.php +lib/Models/EmailRecipients.php +lib/Models/EmailTextLinesResult.php +lib/Models/EmailValidationRequestDto.php +lib/Models/EmailVerificationResult.php +lib/Models/EmergencyAddress.php +lib/Models/EmergencyAddressDto.php +lib/Models/EmptyResponseDto.php +lib/Models/ExpirationDefaults.php +lib/Models/ExpiredInboxDto.php +lib/Models/ExpiredInboxRecordProjection.php +lib/Models/ExportLink.php +lib/Models/ExportOptions.php +lib/Models/FilterBouncedRecipientsOptions.php +lib/Models/FilterBouncedRecipientsResult.php +lib/Models/FlushExpiredInboxesResult.php +lib/Models/ForwardEmailOptions.php +lib/Models/GravatarUrl.php +lib/Models/GroupContactsDto.php +lib/Models/GroupDto.php +lib/Models/GroupProjection.php +lib/Models/HTMLValidationResult.php +lib/Models/IPAddressResult.php +lib/Models/ImapFlagOperationOptions.php +lib/Models/ImapSmtpAccessDetails.php +lib/Models/InboxByEmailAddressResult.php +lib/Models/InboxByNameResult.php +lib/Models/InboxDto.php +lib/Models/InboxExistsDto.php +lib/Models/InboxForwarderDto.php +lib/Models/InboxForwarderEventProjection.php +lib/Models/InboxForwarderTestOptions.php +lib/Models/InboxForwarderTestResult.php +lib/Models/InboxIdItem.php +lib/Models/InboxIdsResult.php +lib/Models/InboxPreview.php +lib/Models/InboxRulesetDto.php +lib/Models/InboxRulesetTestOptions.php +lib/Models/InboxRulesetTestResult.php +lib/Models/JSONSchemaDto.php +lib/Models/ListUnsubscribeRecipientProjection.php +lib/Models/MatchOption.php +lib/Models/MatchOptions.php +lib/Models/MissedEmailDto.php +lib/Models/MissedEmailProjection.php +lib/Models/ModelInterface.php +lib/Models/NameServerRecord.php +lib/Models/OrganizationInboxProjection.php +lib/Models/PageAlias.php +lib/Models/PageAttachmentEntity.php +lib/Models/PageBouncedEmail.php +lib/Models/PageBouncedRecipients.php +lib/Models/PageComplaint.php +lib/Models/PageContactProjection.php +lib/Models/PageDeliveryStatus.php +lib/Models/PageEmailPreview.php +lib/Models/PageEmailProjection.php +lib/Models/PageEmailValidationRequest.php +lib/Models/PageExpiredInboxRecordProjection.php +lib/Models/PageGroupProjection.php +lib/Models/PageInboxForwarderDto.php +lib/Models/PageInboxForwarderEvents.php +lib/Models/PageInboxProjection.php +lib/Models/PageInboxRulesetDto.php +lib/Models/PageListUnsubscribeRecipients.php +lib/Models/PageMissedEmailProjection.php +lib/Models/PageOrganizationInboxProjection.php +lib/Models/PagePhoneNumberProjection.php +lib/Models/PageScheduledJobs.php +lib/Models/PageSentEmailProjection.php +lib/Models/PageSentEmailWithQueueProjection.php +lib/Models/PageSmsProjection.php +lib/Models/PageTemplateProjection.php +lib/Models/PageThreadProjection.php +lib/Models/PageTrackingPixelProjection.php +lib/Models/PageUnknownMissedEmailProjection.php +lib/Models/PageWebhookProjection.php +lib/Models/PageWebhookResult.php +lib/Models/PageableObject.php +lib/Models/PhoneNumberDto.php +lib/Models/PhoneNumberProjection.php +lib/Models/PhonePlanDto.php +lib/Models/RawEmailJson.php +lib/Models/Recipient.php +lib/Models/ReplyToAliasEmailOptions.php +lib/Models/ReplyToEmailOptions.php +lib/Models/ScheduledJob.php +lib/Models/ScheduledJobDto.php +lib/Models/SendEmailOptions.php +lib/Models/SendSMTPEnvelopeOptions.php +lib/Models/SendWithQueueResult.php +lib/Models/Sender.php +lib/Models/SentEmailDto.php +lib/Models/SentEmailProjection.php +lib/Models/SetInboxFavouritedOptions.php +lib/Models/SimpleSendEmailOptions.php +lib/Models/SmsDto.php +lib/Models/SmsMatchOption.php +lib/Models/SmsPreview.php +lib/Models/SmsProjection.php +lib/Models/Sort.php +lib/Models/TemplateDto.php +lib/Models/TemplatePreview.php +lib/Models/TemplateProjection.php +lib/Models/TemplateVariable.php +lib/Models/TestNewInboxForwarderOptions.php +lib/Models/TestNewInboxRulesetOptions.php +lib/Models/TestPhoneNumberOptions.php +lib/Models/ThreadProjection.php +lib/Models/TrackingPixelDto.php +lib/Models/TrackingPixelProjection.php +lib/Models/UnknownMissedEmailProjection.php +lib/Models/UnreadCount.php +lib/Models/UnseenErrorCountDto.php +lib/Models/UpdateAliasOptions.php +lib/Models/UpdateDomainOptions.php +lib/Models/UpdateGroupContacts.php +lib/Models/UpdateInboxOptions.php +lib/Models/UploadAttachmentBytesRequest.php +lib/Models/UploadAttachmentOptions.php +lib/Models/UploadMultipartFormRequest.php +lib/Models/UserInfoDto.php +lib/Models/ValidateEmailAddressListOptions.php +lib/Models/ValidateEmailAddressListResult.php +lib/Models/ValidationDto.php +lib/Models/ValidationMessage.php +lib/Models/VerifyEmailAddressOptions.php +lib/Models/VerifyWebhookSignatureOptions.php +lib/Models/VerifyWebhookSignatureResults.php +lib/Models/WaitForConditions.php +lib/Models/WaitForSingleSmsOptions.php +lib/Models/WaitForSmsConditions.php +lib/Models/WebhookBouncePayload.php +lib/Models/WebhookBounceRecipientPayload.php +lib/Models/WebhookDeliveryStatusPayload.php +lib/Models/WebhookDto.php +lib/Models/WebhookEmailOpenedPayload.php +lib/Models/WebhookEmailReadPayload.php +lib/Models/WebhookHeaderNameValue.php +lib/Models/WebhookHeaders.php +lib/Models/WebhookNewAttachmentPayload.php +lib/Models/WebhookNewContactPayload.php +lib/Models/WebhookNewEmailPayload.php +lib/Models/WebhookNewSmsPayload.php +lib/Models/WebhookProjection.php +lib/Models/WebhookRedriveResult.php +lib/Models/WebhookResultDto.php +lib/Models/WebhookTestRequest.php +lib/Models/WebhookTestResponse.php +lib/Models/WebhookTestResult.php +lib/ObjectSerializer.php +phpunit.xml.dist +test/Api/AliasControllerApiTest.php +test/Api/ApiUserControllerApiTest.php +test/Api/AttachmentControllerApiTest.php +test/Api/BounceControllerApiTest.php +test/Api/BulkActionsControllerApiTest.php +test/Api/CommonActionsControllerApiTest.php +test/Api/ContactControllerApiTest.php +test/Api/DomainControllerApiTest.php +test/Api/EmailControllerApiTest.php +test/Api/EmailVerificationControllerApiTest.php +test/Api/ExpiredControllerApiTest.php +test/Api/ExportControllerApiTest.php +test/Api/FormControllerApiTest.php +test/Api/GroupControllerApiTest.php +test/Api/InboxControllerApiTest.php +test/Api/InboxForwarderControllerApiTest.php +test/Api/InboxRulesetControllerApiTest.php +test/Api/MailServerControllerApiTest.php +test/Api/MissedEmailControllerApiTest.php +test/Api/PhoneControllerApiTest.php +test/Api/SentEmailsControllerApiTest.php +test/Api/SmsControllerApiTest.php +test/Api/TemplateControllerApiTest.php +test/Api/TrackingControllerApiTest.php +test/Api/WaitForControllerApiTest.php +test/Api/WebhookControllerApiTest.php +test/Model/AbstractWebhookPayloadTest.php +test/Model/AliasDtoTest.php +test/Model/AliasProjectionTest.php +test/Model/AttachmentEntityTest.php +test/Model/AttachmentMetaDataTest.php +test/Model/AttachmentProjectionTest.php +test/Model/BasicAuthOptionsTest.php +test/Model/BounceProjectionTest.php +test/Model/BounceRecipientProjectionTest.php +test/Model/BouncedEmailDtoTest.php +test/Model/BouncedRecipientDtoTest.php +test/Model/BulkSendEmailOptionsTest.php +test/Model/ComplaintTest.php +test/Model/ConditionOptionTest.php +test/Model/ContactDtoTest.php +test/Model/ContactProjectionTest.php +test/Model/ContentMatchOptionsTest.php +test/Model/CountDtoTest.php +test/Model/CreateAliasOptionsTest.php +test/Model/CreateContactOptionsTest.php +test/Model/CreateDomainOptionsTest.php +test/Model/CreateEmergencyAddressOptionsTest.php +test/Model/CreateGroupOptionsTest.php +test/Model/CreateInboxDtoTest.php +test/Model/CreateInboxForwarderOptionsTest.php +test/Model/CreateInboxRulesetOptionsTest.php +test/Model/CreateTemplateOptionsTest.php +test/Model/CreateTrackingPixelOptionsTest.php +test/Model/CreateWebhookOptionsTest.php +test/Model/DNSLookupOptionsTest.php +test/Model/DNSLookupResultTest.php +test/Model/DNSLookupResultsTest.php +test/Model/DeliveryStatusDtoTest.php +test/Model/DescribeDomainOptionsTest.php +test/Model/DescribeMailServerDomainResultTest.php +test/Model/DomainDtoTest.php +test/Model/DomainNameRecordTest.php +test/Model/DomainPreviewTest.php +test/Model/DownloadAttachmentDtoTest.php +test/Model/EmailAnalysisTest.php +test/Model/EmailContentMatchResultTest.php +test/Model/EmailHtmlDtoTest.php +test/Model/EmailLinksResultTest.php +test/Model/EmailPreviewTest.php +test/Model/EmailPreviewUrlsTest.php +test/Model/EmailProjectionTest.php +test/Model/EmailRecipientsTest.php +test/Model/EmailTest.php +test/Model/EmailTextLinesResultTest.php +test/Model/EmailValidationRequestDtoTest.php +test/Model/EmailVerificationResultTest.php +test/Model/EmergencyAddressDtoTest.php +test/Model/EmergencyAddressTest.php +test/Model/EmptyResponseDtoTest.php +test/Model/ExpirationDefaultsTest.php +test/Model/ExpiredInboxDtoTest.php +test/Model/ExpiredInboxRecordProjectionTest.php +test/Model/ExportLinkTest.php +test/Model/ExportOptionsTest.php +test/Model/FilterBouncedRecipientsOptionsTest.php +test/Model/FilterBouncedRecipientsResultTest.php +test/Model/FlushExpiredInboxesResultTest.php +test/Model/ForwardEmailOptionsTest.php +test/Model/GravatarUrlTest.php +test/Model/GroupContactsDtoTest.php +test/Model/GroupDtoTest.php +test/Model/GroupProjectionTest.php +test/Model/HTMLValidationResultTest.php +test/Model/IPAddressResultTest.php +test/Model/ImapFlagOperationOptionsTest.php +test/Model/ImapSmtpAccessDetailsTest.php +test/Model/InboxByEmailAddressResultTest.php +test/Model/InboxByNameResultTest.php +test/Model/InboxDtoTest.php +test/Model/InboxExistsDtoTest.php +test/Model/InboxForwarderDtoTest.php +test/Model/InboxForwarderEventProjectionTest.php +test/Model/InboxForwarderTestOptionsTest.php +test/Model/InboxForwarderTestResultTest.php +test/Model/InboxIdItemTest.php +test/Model/InboxIdsResultTest.php +test/Model/InboxPreviewTest.php +test/Model/InboxRulesetDtoTest.php +test/Model/InboxRulesetTestOptionsTest.php +test/Model/InboxRulesetTestResultTest.php +test/Model/JSONSchemaDtoTest.php +test/Model/ListUnsubscribeRecipientProjectionTest.php +test/Model/MatchOptionTest.php +test/Model/MatchOptionsTest.php +test/Model/MissedEmailDtoTest.php +test/Model/MissedEmailProjectionTest.php +test/Model/NameServerRecordTest.php +test/Model/OrganizationInboxProjectionTest.php +test/Model/PageAliasTest.php +test/Model/PageAttachmentEntityTest.php +test/Model/PageBouncedEmailTest.php +test/Model/PageBouncedRecipientsTest.php +test/Model/PageComplaintTest.php +test/Model/PageContactProjectionTest.php +test/Model/PageDeliveryStatusTest.php +test/Model/PageEmailPreviewTest.php +test/Model/PageEmailProjectionTest.php +test/Model/PageEmailValidationRequestTest.php +test/Model/PageExpiredInboxRecordProjectionTest.php +test/Model/PageGroupProjectionTest.php +test/Model/PageInboxForwarderDtoTest.php +test/Model/PageInboxForwarderEventsTest.php +test/Model/PageInboxProjectionTest.php +test/Model/PageInboxRulesetDtoTest.php +test/Model/PageListUnsubscribeRecipientsTest.php +test/Model/PageMissedEmailProjectionTest.php +test/Model/PageOrganizationInboxProjectionTest.php +test/Model/PagePhoneNumberProjectionTest.php +test/Model/PageScheduledJobsTest.php +test/Model/PageSentEmailProjectionTest.php +test/Model/PageSentEmailWithQueueProjectionTest.php +test/Model/PageSmsProjectionTest.php +test/Model/PageTemplateProjectionTest.php +test/Model/PageThreadProjectionTest.php +test/Model/PageTrackingPixelProjectionTest.php +test/Model/PageUnknownMissedEmailProjectionTest.php +test/Model/PageWebhookProjectionTest.php +test/Model/PageWebhookResultTest.php +test/Model/PageableObjectTest.php +test/Model/PhoneNumberDtoTest.php +test/Model/PhoneNumberProjectionTest.php +test/Model/PhonePlanDtoTest.php +test/Model/RawEmailJsonTest.php +test/Model/RecipientTest.php +test/Model/ReplyToAliasEmailOptionsTest.php +test/Model/ReplyToEmailOptionsTest.php +test/Model/ScheduledJobDtoTest.php +test/Model/ScheduledJobTest.php +test/Model/SendEmailOptionsTest.php +test/Model/SendSMTPEnvelopeOptionsTest.php +test/Model/SendWithQueueResultTest.php +test/Model/SenderTest.php +test/Model/SentEmailDtoTest.php +test/Model/SentEmailProjectionTest.php +test/Model/SetInboxFavouritedOptionsTest.php +test/Model/SimpleSendEmailOptionsTest.php +test/Model/SmsDtoTest.php +test/Model/SmsMatchOptionTest.php +test/Model/SmsPreviewTest.php +test/Model/SmsProjectionTest.php +test/Model/SortTest.php +test/Model/TemplateDtoTest.php +test/Model/TemplatePreviewTest.php +test/Model/TemplateProjectionTest.php +test/Model/TemplateVariableTest.php +test/Model/TestNewInboxForwarderOptionsTest.php +test/Model/TestNewInboxRulesetOptionsTest.php +test/Model/TestPhoneNumberOptionsTest.php +test/Model/ThreadProjectionTest.php +test/Model/TrackingPixelDtoTest.php +test/Model/TrackingPixelProjectionTest.php +test/Model/UnknownMissedEmailProjectionTest.php +test/Model/UnreadCountTest.php +test/Model/UnseenErrorCountDtoTest.php +test/Model/UpdateAliasOptionsTest.php +test/Model/UpdateDomainOptionsTest.php +test/Model/UpdateGroupContactsTest.php +test/Model/UpdateInboxOptionsTest.php +test/Model/UploadAttachmentBytesRequestTest.php +test/Model/UploadAttachmentOptionsTest.php +test/Model/UploadMultipartFormRequestTest.php +test/Model/UserInfoDtoTest.php +test/Model/ValidateEmailAddressListOptionsTest.php +test/Model/ValidateEmailAddressListResultTest.php +test/Model/ValidationDtoTest.php +test/Model/ValidationMessageTest.php +test/Model/VerifyEmailAddressOptionsTest.php +test/Model/VerifyWebhookSignatureOptionsTest.php +test/Model/VerifyWebhookSignatureResultsTest.php +test/Model/WaitForConditionsTest.php +test/Model/WaitForSingleSmsOptionsTest.php +test/Model/WaitForSmsConditionsTest.php +test/Model/WebhookBouncePayloadTest.php +test/Model/WebhookBounceRecipientPayloadTest.php +test/Model/WebhookDeliveryStatusPayloadTest.php +test/Model/WebhookDtoTest.php +test/Model/WebhookEmailOpenedPayloadTest.php +test/Model/WebhookEmailReadPayloadTest.php +test/Model/WebhookHeaderNameValueTest.php +test/Model/WebhookHeadersTest.php +test/Model/WebhookNewAttachmentPayloadTest.php +test/Model/WebhookNewContactPayloadTest.php +test/Model/WebhookNewEmailPayloadTest.php +test/Model/WebhookNewSmsPayloadTest.php +test/Model/WebhookProjectionTest.php +test/Model/WebhookRedriveResultTest.php +test/Model/WebhookResultDtoTest.php +test/Model/WebhookTestRequestTest.php +test/Model/WebhookTestResponseTest.php +test/Model/WebhookTestResultTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 00000000..0df17dd0 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..af9cf39f --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..667b8156 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic +php: + - 7.4 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..b1578dad --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2023 MailSlurp Email API (Provided by Pettman OÜ, Estonia) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..e7f027a3 --- /dev/null +++ b/README.md @@ -0,0 +1,426 @@ +# PHP Email API - Documentation + +> Create and manage email addresses in PHP. Send and receive emails and attachments in code and tests. + +## Quick links + +- [Download PHP Plugin](https://www.github.com/mailslurp/mailslurp-client-php/) +- [GitHub Repository](https://www.github.com/mailslurp/mailslurp-client-php/) +- [Official PHP Library](https://packagist.org/packages/mailslurp/mailslurp-client-php) +- [Full method documentation](https://docs.mailslurp.com/php/docs/) + +## Examples + +- [PHP Codeception Selenium Example](https://www.mailslurp.com/examples/php-test-email-api-codeception/) +- [PHPUnit Example](https://www.mailslurp.com/examples/phpunit-email-testing/) +- [PHP send email with SMTP](https://www.mailslurp.com/smtp/php-send-email-smtp/) + +## Get started + +MailSlurp is an email API that lets you create email addresses on demand then send and receive emails in code and tests. **No MailServer is required**. + +This section describes how to get up and running with the PHP client. To use another language or the REST API see the [developer page](https://www.mailslurp.com/developers/). + +See the examples page for [code examples and use with common frameworks](https://www.mailslurp.com/examples/). + +See the method documentation for a [list of all functions](https://docs.mailslurp.com/php/docs/). + +## Get an API Key + +You need a free MailSlurp account to use the service. [Sign up for a free account](https://app.mailslurp.com/sign-up/) first. + +Once signed up [login your dashboard](https://app.mailslurp.com/login/). Find your API Key and copy the code. You'll need this to configure the MailSlurp client in PHP. + +![find-api-key](https://www.mailslurp.com/assets/guides/find-api-key.png) + +Copy your API Key from the [MailSlurp dashboard](https://app.mailslurp.com). + +## PHP Setup + +The client is tested for PHP 7 and requires the following non-default PHP extensions to be installed: + +```bash +php-ext-curl +php-xml +php-mbstring +``` + +Typically these come with most PHP installations. They can also be installed like so: + +`sudo apt-get install php-ext-curl php-mbstring php-xml` + +## Add PHP Library + +There are several ways to install MailSlurp. + +### a) Composer dependency + +If you use the [composer package manager](https://getcomposer.org) you can run + +```bash +composer require mailslurp/mailslurp-client-php +``` + +Or add it to your `composer.json` file: + +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/mailslurp/mailslurp-client-php.git" + } + ], + "require": { + "mailslurp/mailslurp-client-php": "*@dev" + } +} +``` + +Then include the library with the composer autoload convention: + +```php + + +![php-email-library-github](https://www.mailslurp.com/assets/guides/php-download.png) + +Download the MailSlurp PHP email libraryMailSlurp dashboard. + + +Then include the files to have access to MailSlurp in your code: + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); + +// create controllers to access parts of the MailSlurp API +$inboxController = new MailSlurp\Apis\InboxControllerApi(null, $config); +$waitForController = new MailSlurp\Apis\WaitForControllerApi(null, $config); +``` + +A common test pattern might look like this: + +```php +assertNotEmpty($API_KEY, "API Key must not be empty"); + + // create configuration with api key + $this->config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', $API_KEY); + } +} +``` + +## Basic usage + +A common use case is to create a new email address, send it an email and then receive the contents: + +### Create an email address + +To create an email address use the inbox controller to create a new inbox. Inboxes have real email addresses and can send and receive emails and attachments. + +```php +config); + + // create inbox + $inbox = $inboxController->createInbox(); + + // assert on properties + $this->assertNotNull($inbox->getId()); + $this->assertStringContainsString("@mailslurp.com", $inbox->getEmailAddress()); +} +``` + +#### Inbox types + +Inboxes can be either `SMTP` or `HTTP` type. Set the inbox type using the `inboxType` property. SMTP inboxes are handled by a custom mailserver and support a wide range of clients while HTTP inboxes use Amazon SES and don't support some older clients like Outlook. SMTP inboxes are recommended for public facing email addresses while HTTP inboxes are best for application testing. Please see the guide on [types of inboxes](https://www.mailslurp.com/guides/smtp-vs-http-email-inboxes/) for more information. + + +### SMTP access (PHPMailer, mail function etc.) +SMTP inboxes provide IMAP and SMTP access credentials via the `getImapSmtpAccess` function. + +```php +config); +$inbox1 = $inboxController->createInboxWithOptions(new \MailSlurp\Models\CreateInboxDto([ "inbox_type" => "SMTP_INBOX"])); +$this->assertStringContainsString("@mailslurp.mx", $inbox1->getEmailAddress()); + +$inbox2 = $inboxController->createInbox(); +$smtpAccess = $inboxController->getImapSmtpAccess($inbox1->getId()); +``` + +Use the host, port, username and password returned to configure PHPMailer, PearMailer or other SMTP sending clients. + +```php +SMTPDebug = SMTP::DEBUG_SERVER; + $mail->isSMTP(); + $mail->SMTPAuth = true; + $mail->Host = $smtpAccess->getSmtpServerHost(); + $mail->Username = $smtpAccess->getSmtpUsername(); + $mail->Password = $smtpAccess->getSmtpPassword(); + $mail->SMTPSecure = ''; + $mail->Port = $smtpAccess->getSmtpServerPort(); + + // test connection (secure disabled) + $connected = $mail->smtpConnect(); + $this->assertTrue($connected); + + // write email from inbox1 to inbox2 + $mail->setFrom($inbox1->getEmailAddress()); + $mail->addAddress($inbox2->getEmailAddress()); + $mail->isHTML(true); + $mail->Subject = 'Hello inbox2'; + $mail->Body = 'This is an HTML message'; + + // send the email + $sent = $mail->send(); + + $this->assertTrue($sent); +} catch (Exception $e) { + echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; + throw new Exception($mail->ErrorInfo); +} +``` + + +### List inboxes + +Inbox lists are paginated. + +```php +config); + + $pageInboxes = $inboxController->getAllInboxes($favourite = null, $page = 0, $size = 20); + + // assert pagination properties + $this->assertEquals(0, $pageInboxes->getNumber()); + $this->assertEquals(20, $pageInboxes->getSize()); + $this->assertGreaterThan(0, $pageInboxes->getTotalElements()); + + // access inboxes via content + foreach ($pageInboxes->getContent() as $inbox) { + $this->assertNotNull($inbox->getId()); + } +} +``` + +### Send an email + +To send an email first create an inbox. Then use the `sendEmail` method on the `InboxController` and pass it the sender inbox's ID and email options. + +```php +config); + $inbox = $inboxController->createInbox(); + + // send options + $sendOptions = new MailSlurp\Models\SendEmailOptions(); + $sendOptions->setTo([$inbox->getEmailAddress()]); + $sendOptions->setSubject("Welcome"); + $sendOptions->setIsHtml(true); + // (you can use normal strings too) + $sendOptions->setBody(<< +

MailSlurp supports HTML

+ + EOF); + + // send + $inboxController->sendEmail($inbox->getId(), $sendOptions); +} +``` + +### Attachments + +Using attachments in PHP is easy. For sending attachments you must first upload each file and store the returned attachment IDs. +For sending use these IDs with `SendEmailOptions`. Received email attachments can be downloaded using the `EmailControllerApi`. + +```php +pathToAttachment; + + // read file contents + $contents = file_get_contents($pathToAttachment); + + // encode the file contents to a base64 encoded string for uploading + $base64Contents = base64_encode($contents); + + // extract file name from path + $filename = basename($pathToAttachment); + + // get the mime type from the file name + $contentType = mime_content_type($filename); + + // set upload options + $uploadOptions = new MailSlurp\Models\UploadAttachmentOptions(); + $uploadOptions->setFilename($filename); + $uploadOptions->setContentType($contentType); + $uploadOptions->setBase64Contents($base64Contents); + + // now upload using attachment controller + $attachmentController = new MailSlurp\Apis\AttachmentControllerApi(null, $this->config); + + // returns [$attachmentId] + return $attachmentController->uploadAttachment($uploadOptions); +} +``` + +To send the attachments use like so: + +```php +uploadAttachment(); + +// send options with attachments +$sendOptions = new MailSlurp\Models\SendEmailOptions(); +$sendOptions->setTo([$inbox->getEmailAddress()]); +$sendOptions->setSubject("See attached!"); +$sendOptions->setAttachments($attachmentIds); + +$inboxController->sendEmail($inbox->getId(), $sendOptions); +``` + +### Receive an email + +You can receive emails in PHP using MailSlurp. First create an inbox then call a `waitFor` method. These methods wait until a new unread email has arrived and return it. + +```php +waitForLatestEmail($inbox->getId(), $timeout_millis, $unread_only); + +// access email content and properties +print_r($email->getBody()) +print_r($email->getSubject()) +``` + +Larger example: + +```php +config); + +$inbox1= $inboxController->createInbox(); +$inbox2 = $inboxController->createInbox(); + +// send options +$sendOptions = new MailSlurp\Models\SendEmailOptions(); +$sendOptions->setTo([$inbox2->getEmailAddress()]); +$sendOptions->setSubject("Here are your files"); +$sendOptions->setBody("Hello JOE"); +$sendOptions->setIsHtml(true); + +// send email from inbox 1 to inbox 2 using options above +$inboxController->sendEmail($inbox1->getId(), $sendOptions); + +// wait for email to arrive in inbox 2 +$waitForController = new MailSlurp\Apis\WaitForControllerApi(null, $this->config); +$email = $waitForController->waitForLatestEmail($inbox_id=$inbox2->getId(), $timeout=30000); + +// access email contents +$this->assertEquals($email->getInboxId(), $inbox2->getId()); +$this->assertStringContainsString("Here are your files", $email->getSubject()); +``` + +### Receive attachment + +Test example: + +```php +getAttachments()[0]; + +// download an attachment as base 64 encoded string +$emailController = new MailSlurp\Apis\EmailControllerApi(null, $this->config); +$downloadedAttachment = $emailController->downloadAttachmentBase64($emailAttachmentId1, $email->getId()); + +$this->assertGreaterThan(0, $downloadedAttachment->getSizeBytes()); +$this->assertEquals("text/plain", $downloadedAttachment->getContentType()); + +// decode file contents +$content = base64_decode($downloadedAttachment->getBase64FileContents()); +$this->assertStringContainsString("Sample upload file", $content); +``` + +### Extract email content + +You can use regex to parse codes or statements for email bodies like so: + +```php +waitForLatestEmail($inbox_id = $inbox->getId(), $timeout = 30000, $unread_only = true); + +// extract the confirmation code +preg_match("/verification code is ([0-9]{6})/", $email->getBody(), $matches); +$code = $matches[1]; +``` + +## SDK Documentation + +For more functions and examples [read the library documentation](https://docs.mailslurp.com/php/docs/) or see the [PHP guides](https://www.mailslurp.com/tags/php). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..dc36834d --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,4 @@ +# Security + +This client calls the MailSlurp API endpoints. Connections should be made over secure HTTPS using your secure API Token. Do not share or commit the token if you can avoid doing so. +To report security issues or talk with MailSlurp support please email [support@mailslurp.zendesk.com](mailto:support@mailslurp.zendesk.com). diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 00000000..96f6bd0f --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,4 @@ +# Support + +To report issues or talk with MailSlurp support please email [support@mailslurp.zendesk.com](mailto:support@mailslurp.zendesk.com). +Alternatively you can visit our [support portal](https://mailslurp.zendesk.com) or open a ticket in the corresponding [Github repository](https://www.github.com/mailslurp). diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..8f58e8a8 --- /dev/null +++ b/composer.json @@ -0,0 +1,40 @@ +{ + "name": "mailslurp/mailslurp-client-php", + "version": "15.16.5", + "description": "MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://www.mailslurp.com", + "license": "unlicense", + "authors": [ + { + "name": "MailSlurp", + "homepage": "https://www.mailslurp.com" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^1.7 || ^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0", + "friendsofphp/php-cs-fixer": "^3.5" + }, + "autoload": { + "psr-4": { "MailSlurp\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "MailSlurp\\Test\\" : "test/" } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..dbae6fd5 --- /dev/null +++ b/composer.lock @@ -0,0 +1,4301 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "f11fd5e4a60b92553836bc4991598fba", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "7.5.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.9 || ^2.4", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.5.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-08-28T15:39:27+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "b94b2807d85443f9719887892882d0329d1e2598" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2022-08-28T14:55:35+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.4.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "67c26b443f348a51926030c83481b85718457d3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", + "reference": "67c26b443f348a51926030c83481b85718457d3d", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.4.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-10-26T14:07:24+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2019-04-30T12:38:16+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-25T10:21:52+00:00" + } + ], + "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-11-17T09:50:14+00:00" + }, + { + "name": "composer/semver", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-04-01T19:23:25+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "doctrine/annotations", + "version": "1.14.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "ad785217c1e9555a7d6c6c8c9f406395a5e2882b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/ad785217c1e9555a7d6c6c8c9f406395a5e2882b", + "reference": "ad785217c1e9555a7d6c6c8c9f406395a5e2882b", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1 || ^2", + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.14.2" + }, + "time": "2022-12-15T06:48:22+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:23:10+00:00" + }, + { + "name": "doctrine/lexer", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/2.1.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-12-14T08:49:07+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.13.2", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "3952f08a81bd3b1b15e11c3de0b6bf037faa8496" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/3952f08a81bd3b1b15e11c3de0b6bf037faa8496", + "reference": "3952f08a81bd3b1b15e11c3de0b6bf037faa8496", + "shasum": "" + }, + "require": { + "composer/semver": "^3.2", + "composer/xdebug-handler": "^3.0.3", + "doctrine/annotations": "^1.13", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/options-resolver": "^5.4 || ^6.0", + "symfony/polyfill-mbstring": "^1.23", + "symfony/polyfill-php80": "^1.25", + "symfony/polyfill-php81": "^1.25", + "symfony/process": "^5.4 || ^6.0", + "symfony/stopwatch": "^5.4 || ^6.0" + }, + "require-dev": { + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.0", + "mikey179/vfsstream": "^1.6.10", + "php-coveralls/php-coveralls": "^2.5.2", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", + "symfony/phpunit-bridge": "^6.0", + "symfony/yaml": "^5.4 || ^6.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.13.2" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-01-02T23:53:50+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.15.3", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + }, + "time": "2023-01-16T22:05:37+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.23", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.14", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-12-28T12:41:10+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.5.28", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-01-14T12:32:24+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-03T09:37:03+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-12T14:47:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/console", + "version": "v6.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0f579613e771dba2dbb8211c382342a641f5da06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0f579613e771dba2dbb8211c382342a641f5da06", + "reference": "0f579613e771dba2dbb8211c382342a641f5da06", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-12-28T14:26:22+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.2.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "3ffeb31139b49bf6ef0bc09d1db95eac053388d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ffeb31139b49bf6ef0bc09d1db95eac053388d1", + "reference": "3ffeb31139b49bf6ef0bc09d1db95eac053388d1", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^5.4|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-12-14T16:11:27+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "0782b0b52a737a05b4383d0df35a474303cabdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0782b0b52a737a05b4383d0df35a474303cabdae", + "reference": "0782b0b52a737a05b4383d0df35a474303cabdae", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-25T10:21:52+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/50b2523c874605cf3d4acf7a9e2b30b6a440a016", + "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v6.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-20T13:01:27+00:00" + }, + { + "name": "symfony/finder", + "version": "v6.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/81eefbddfde282ee33b437ba5e13d7753211ae8e", + "reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v6.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-12-22T17:55:15+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "d28f02acde71ff75e957082cd36e973df395f626" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/d28f02acde71ff75e957082cd36e973df395f626", + "reference": "d28f02acde71ff75e957082cd36e973df395f626", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v6.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-02T09:08:04+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/process", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/ba6e55359f8f755fe996c58a81e00eaa67a35877", + "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-02T09:08:04+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-25T10:21:52+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "266636bb8f3fbdccc302491df7b3a1b9a8c238a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/266636bb8f3fbdccc302491df7b3a1b9a8c238a7", + "reference": "266636bb8f3fbdccc302491df7b3a1b9a8c238a7", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/service-contracts": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v6.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-09-28T16:00:52+00:00" + }, + { + "name": "symfony/string", + "version": "v6.2.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "863219fd713fa41cbcd285a79723f94672faff4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/863219fd713fa41cbcd285a79723f94672faff4d", + "reference": "863219fd713fa41cbcd285a79723f94672faff4d", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.2.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-12-14T16:11:27+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/docs/Api/AliasControllerApi.md b/docs/Api/AliasControllerApi.md new file mode 100644 index 00000000..e2df4f8c --- /dev/null +++ b/docs/Api/AliasControllerApi.md @@ -0,0 +1,605 @@ +# MailSlurp\AliasControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createAlias()**](AliasControllerApi#createAlias) | **POST** /aliases | Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. | +| [**deleteAlias()**](AliasControllerApi#deleteAlias) | **DELETE** /aliases/{aliasId} | Delete an email alias | +| [**getAlias()**](AliasControllerApi#getAlias) | **GET** /aliases/{aliasId} | Get an email alias | +| [**getAliasEmails()**](AliasControllerApi#getAliasEmails) | **GET** /aliases/{aliasId}/emails | Get emails for an alias | +| [**getAliasThreads()**](AliasControllerApi#getAliasThreads) | **GET** /aliases/{aliasId}/threads | Get threads created for an alias | +| [**getAliases()**](AliasControllerApi#getAliases) | **GET** /aliases | Get all email aliases you have created | +| [**replyToAliasEmail()**](AliasControllerApi#replyToAliasEmail) | **PUT** /aliases/{aliasId}/emails/{emailId} | Reply to an email | +| [**sendAliasEmail()**](AliasControllerApi#sendAliasEmail) | **POST** /aliases/{aliasId}/emails | Send an email from an alias inbox | +| [**updateAlias()**](AliasControllerApi#updateAlias) | **PUT** /aliases/{aliasId} | Update an email alias | + + +## `createAlias()` + +```php +createAlias($create_alias_options): \MailSlurp\Models\AliasDto +``` + +Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. + +Email aliases use a MailSlurp randomly generated email address (or a custom domain inbox that you provide) to mask or proxy a real email address. Emails sent to the alias address will be forwarded to the hidden email address it was created for. If you want to send a reply use the threadId attached + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_alias_options = new \MailSlurp\Models\CreateAliasOptions(); // \MailSlurp\Models\CreateAliasOptions + +try { + $result = $apiInstance->createAlias($create_alias_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->createAlias: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_alias_options** | [**\MailSlurp\Models\CreateAliasOptions**](../Model/CreateAliasOptions)| | | + +### Return type + +[**\MailSlurp\Models\AliasDto**](../Model/AliasDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAlias()` + +```php +deleteAlias($alias_id) +``` + +Delete an email alias + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string + +try { + $apiInstance->deleteAlias($alias_id); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->deleteAlias: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAlias()` + +```php +getAlias($alias_id): \MailSlurp\Models\AliasDto +``` + +Get an email alias + +Get an email alias by ID + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string + +try { + $result = $apiInstance->getAlias($alias_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->getAlias: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\AliasDto**](../Model/AliasDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAliasEmails()` + +```php +getAliasEmails($alias_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageEmailProjection +``` + +Get emails for an alias + +Get paginated emails for an alias by ID + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string +$page = 0; // int | Optional page index alias email list pagination +$size = 20; // int | Optional page size alias email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent before given date time + +try { + $result = $apiInstance->getAliasEmails($alias_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->getAliasEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | +| **page** | **int**| Optional page index alias email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size alias email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Optional filter by sent after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by sent before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageEmailProjection**](../Model/PageEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAliasThreads()` + +```php +getAliasThreads($alias_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageThreadProjection +``` + +Get threads created for an alias + +Returns threads created for an email alias in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string +$page = 0; // int | Optional page index in thread list pagination +$size = 20; // int | Optional page size in thread list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent before given date time + +try { + $result = $apiInstance->getAliasThreads($alias_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->getAliasThreads: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | +| **page** | **int**| Optional page index in thread list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in thread list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Optional filter by sent after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by sent before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageThreadProjection**](../Model/PageThreadProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAliases()` + +```php +getAliases($page, $size, $sort, $since, $before): \MailSlurp\Models\PageAlias +``` + +Get all email aliases you have created + +Get all email aliases in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in alias list pagination +$size = 20; // int | Optional page size in alias list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAliases($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->getAliases: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in alias list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in alias list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageAlias**](../Model/PageAlias) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `replyToAliasEmail()` + +```php +replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options): \MailSlurp\Models\SentEmailDto +``` + +Reply to an email + +Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string | ID of the alias that email belongs to +$email_id = 'email_id_example'; // string | ID of the email that should be replied to +$reply_to_alias_email_options = new \MailSlurp\Models\ReplyToAliasEmailOptions(); // \MailSlurp\Models\ReplyToAliasEmailOptions + +try { + $result = $apiInstance->replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->replyToAliasEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| ID of the alias that email belongs to | | +| **email_id** | **string**| ID of the email that should be replied to | | +| **reply_to_alias_email_options** | [**\MailSlurp\Models\ReplyToAliasEmailOptions**](../Model/ReplyToAliasEmailOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendAliasEmail()` + +```php +sendAliasEmail($alias_id, $send_email_options): \MailSlurp\Models\SentEmailDto +``` + +Send an email from an alias inbox + +Send an email from an alias. Replies to the email will be forwarded to the alias masked email address + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions + +try { + $result = $apiInstance->sendAliasEmail($alias_id, $send_email_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->sendAliasEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateAlias()` + +```php +updateAlias($alias_id, $update_alias_options): \MailSlurp\Models\AliasDto +``` + +Update an email alias + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AliasControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$alias_id = 'alias_id_example'; // string +$update_alias_options = new \MailSlurp\Models\UpdateAliasOptions(); // \MailSlurp\Models\UpdateAliasOptions + +try { + $result = $apiInstance->updateAlias($alias_id, $update_alias_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AliasControllerApi->updateAlias: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **alias_id** | **string**| | | +| **update_alias_options** | [**\MailSlurp\Models\UpdateAliasOptions**](../Model/UpdateAliasOptions)| | | + +### Return type + +[**\MailSlurp\Models\AliasDto**](../Model/AliasDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/ApiUserControllerApi.md b/docs/Api/ApiUserControllerApi.md new file mode 100644 index 00000000..4d695225 --- /dev/null +++ b/docs/Api/ApiUserControllerApi.md @@ -0,0 +1,130 @@ +# MailSlurp\ApiUserControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getJsonPropertyAsString()**](ApiUserControllerApi#getJsonPropertyAsString) | **POST** /user/json/pluck | | +| [**getUserInfo()**](ApiUserControllerApi#getUserInfo) | **GET** /user/info | | + + +## `getJsonPropertyAsString()` + +```php +getJsonPropertyAsString($property, $body): string +``` + + + +Utility function to extract properties from JSON objects in language where this is cumbersome. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ApiUserControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$property = 'property_example'; // string | JSON property name or dot separated path selector such as `a.b.c` +$body = array('key' => new \stdClass); // object + +try { + $result = $apiInstance->getJsonPropertyAsString($property, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ApiUserControllerApi->getJsonPropertyAsString: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **property** | **string**| JSON property name or dot separated path selector such as `a.b.c` | | +| **body** | **object**| | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getUserInfo()` + +```php +getUserInfo(): \MailSlurp\Models\UserInfoDto +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ApiUserControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getUserInfo(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ApiUserControllerApi->getUserInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\UserInfoDto**](../Model/UserInfoDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/AttachmentControllerApi.md b/docs/Api/AttachmentControllerApi.md new file mode 100644 index 00000000..5d1210fc --- /dev/null +++ b/docs/Api/AttachmentControllerApi.md @@ -0,0 +1,640 @@ +# MailSlurp\AttachmentControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**deleteAllAttachments()**](AttachmentControllerApi#deleteAllAttachments) | **DELETE** /attachments | Delete all attachments | +| [**deleteAttachment()**](AttachmentControllerApi#deleteAttachment) | **DELETE** /attachments/{attachmentId} | Delete an attachment | +| [**downloadAttachmentAsBase64Encoded()**](AttachmentControllerApi#downloadAttachmentAsBase64Encoded) | **GET** /attachments/{attachmentId}/base64 | Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. | +| [**downloadAttachmentAsBytes()**](AttachmentControllerApi#downloadAttachmentAsBytes) | **GET** /attachments/{attachmentId}/bytes | Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. | +| [**getAttachment()**](AttachmentControllerApi#getAttachment) | **GET** /attachments/{attachmentId} | Get an attachment entity | +| [**getAttachmentInfo()**](AttachmentControllerApi#getAttachmentInfo) | **GET** /attachments/{attachmentId}/metadata | Get email attachment metadata information | +| [**getAttachments()**](AttachmentControllerApi#getAttachments) | **GET** /attachments | Get email attachments | +| [**uploadAttachment()**](AttachmentControllerApi#uploadAttachment) | **POST** /attachments | Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. | +| [**uploadAttachmentBytes()**](AttachmentControllerApi#uploadAttachmentBytes) | **POST** /attachments/bytes | Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. | +| [**uploadMultipartForm()**](AttachmentControllerApi#uploadMultipartForm) | **POST** /attachments/multipart | Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. | + + +## `deleteAllAttachments()` + +```php +deleteAllAttachments() +``` + +Delete all attachments + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->deleteAllAttachments(); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->deleteAllAttachments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAttachment()` + +```php +deleteAttachment($attachment_id) +``` + +Delete an attachment + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $apiInstance->deleteAttachment($attachment_id); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->deleteAttachment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadAttachmentAsBase64Encoded()` + +```php +downloadAttachmentAsBase64Encoded($attachment_id): \MailSlurp\Models\DownloadAttachmentDto +``` + +Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. + +Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->downloadAttachmentAsBase64Encoded($attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->downloadAttachmentAsBase64Encoded: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +[**\MailSlurp\Models\DownloadAttachmentDto**](../Model/DownloadAttachmentDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadAttachmentAsBytes()` + +```php +downloadAttachmentAsBytes($attachment_id): string +``` + +Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. + +Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->downloadAttachmentAsBytes($attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->downloadAttachmentAsBytes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAttachment()` + +```php +getAttachment($attachment_id): \MailSlurp\Models\AttachmentEntity +``` + +Get an attachment entity + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->getAttachment($attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->getAttachment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +[**\MailSlurp\Models\AttachmentEntity**](../Model/AttachmentEntity) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAttachmentInfo()` + +```php +getAttachmentInfo($attachment_id): \MailSlurp\Models\AttachmentMetaData +``` + +Get email attachment metadata information + +Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties `name` and `content-type` and `content-length` in bytes for a given attachment. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->getAttachmentInfo($attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->getAttachmentInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +[**\MailSlurp\Models\AttachmentMetaData**](../Model/AttachmentMetaData) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAttachments()` + +```php +getAttachments($page, $size, $sort, $file_name_filter, $since, $before): \MailSlurp\Models\PageAttachmentEntity +``` + +Get email attachments + +Get all attachments in paginated response. Each entity contains meta data for the attachment such as `name` and `content-type`. Use the `attachmentId` and the download endpoints to get the file contents. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index for list pagination +$size = 20; // int | Optional page size for list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$file_name_filter = 'file_name_filter_example'; // string | Optional file name and content type search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAttachments($page, $size, $sort, $file_name_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->getAttachments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index for list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size for list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **file_name_filter** | **string**| Optional file name and content type search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageAttachmentEntity**](../Model/PageAttachmentEntity) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `uploadAttachment()` + +```php +uploadAttachment($upload_attachment_options): string[] +``` + +Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$upload_attachment_options = new \MailSlurp\Models\UploadAttachmentOptions(); // \MailSlurp\Models\UploadAttachmentOptions + +try { + $result = $apiInstance->uploadAttachment($upload_attachment_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->uploadAttachment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **upload_attachment_options** | [**\MailSlurp\Models\UploadAttachmentOptions**](../Model/UploadAttachmentOptions)| | | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `uploadAttachmentBytes()` + +```php +uploadAttachmentBytes($upload_attachment_bytes_request, $content_type, $filename): string[] +``` + +Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$upload_attachment_bytes_request = new \MailSlurp\Models\UploadAttachmentBytesRequest(); // \MailSlurp\Models\UploadAttachmentBytesRequest +$content_type = 'content_type_example'; // string | Optional contentType for file. For instance `application/pdf` +$filename = 'filename_example'; // string | Optional filename to save upload with + +try { + $result = $apiInstance->uploadAttachmentBytes($upload_attachment_bytes_request, $content_type, $filename); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->uploadAttachmentBytes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **upload_attachment_bytes_request** | [**\MailSlurp\Models\UploadAttachmentBytesRequest**](../Model/UploadAttachmentBytesRequest)| | | +| **content_type** | **string**| Optional contentType for file. For instance `application/pdf` | [optional] | +| **filename** | **string**| Optional filename to save upload with | [optional] | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/octet-stream` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `uploadMultipartForm()` + +```php +uploadMultipartForm($content_type, $filename, $x_filename, $upload_multipart_form_request): string[] +``` + +Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\AttachmentControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$content_type = 'content_type_example'; // string | Optional content type of attachment +$filename = 'filename_example'; // string | Optional name of file +$x_filename = 'x_filename_example'; // string | Optional content type header of attachment +$upload_multipart_form_request = new \MailSlurp\Models\UploadMultipartFormRequest(); // \MailSlurp\Models\UploadMultipartFormRequest + +try { + $result = $apiInstance->uploadMultipartForm($content_type, $filename, $x_filename, $upload_multipart_form_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentControllerApi->uploadMultipartForm: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **content_type** | **string**| Optional content type of attachment | [optional] | +| **filename** | **string**| Optional name of file | [optional] | +| **x_filename** | **string**| Optional content type header of attachment | [optional] | +| **upload_multipart_form_request** | [**\MailSlurp\Models\UploadMultipartFormRequest**](../Model/UploadMultipartFormRequest)| | [optional] | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/BounceControllerApi.md b/docs/Api/BounceControllerApi.md new file mode 100644 index 00000000..8c590f07 --- /dev/null +++ b/docs/Api/BounceControllerApi.md @@ -0,0 +1,478 @@ +# MailSlurp\BounceControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**filterBouncedRecipient()**](BounceControllerApi#filterBouncedRecipient) | **POST** /bounce/filter-recipients | Filter a list of email recipients and remove those who have bounced | +| [**getBouncedEmail()**](BounceControllerApi#getBouncedEmail) | **GET** /bounce/emails/{id} | Get a bounced email. | +| [**getBouncedEmails()**](BounceControllerApi#getBouncedEmails) | **GET** /bounce/emails | Get paginated list of bounced emails. | +| [**getBouncedRecipient()**](BounceControllerApi#getBouncedRecipient) | **GET** /bounce/recipients/{id} | Get a bounced email. | +| [**getBouncedRecipients()**](BounceControllerApi#getBouncedRecipients) | **GET** /bounce/recipients | Get paginated list of bounced recipients. | +| [**getComplaints()**](BounceControllerApi#getComplaints) | **GET** /bounce/complaints | Get paginated list of complaints. | +| [**getListUnsubscribeRecipients()**](BounceControllerApi#getListUnsubscribeRecipients) | **GET** /bounce/list-unsubscribe-recipients | Get paginated list of unsubscribed recipients. | + + +## `filterBouncedRecipient()` + +```php +filterBouncedRecipient($filter_bounced_recipients_options): \MailSlurp\Models\FilterBouncedRecipientsResult +``` + +Filter a list of email recipients and remove those who have bounced + +Prevent email sending errors by remove recipients who have resulted in past email bounces or complaints + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$filter_bounced_recipients_options = new \MailSlurp\Models\FilterBouncedRecipientsOptions(); // \MailSlurp\Models\FilterBouncedRecipientsOptions + +try { + $result = $apiInstance->filterBouncedRecipient($filter_bounced_recipients_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->filterBouncedRecipient: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filter_bounced_recipients_options** | [**\MailSlurp\Models\FilterBouncedRecipientsOptions**](../Model/FilterBouncedRecipientsOptions)| | | + +### Return type + +[**\MailSlurp\Models\FilterBouncedRecipientsResult**](../Model/FilterBouncedRecipientsResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getBouncedEmail()` + +```php +getBouncedEmail($id): \MailSlurp\Models\BouncedEmailDto +``` + +Get a bounced email. + +Bounced emails are email you have sent that were rejected by a recipient + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of the bounced email to fetch + +try { + $result = $apiInstance->getBouncedEmail($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getBouncedEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the bounced email to fetch | | + +### Return type + +[**\MailSlurp\Models\BouncedEmailDto**](../Model/BouncedEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getBouncedEmails()` + +```php +getBouncedEmails($page, $size, $sort, $since, $before): \MailSlurp\Models\PageBouncedEmail +``` + +Get paginated list of bounced emails. + +Bounced emails are email you have sent that were rejected by a recipient + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index +$size = 20; // int | Optional page size +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getBouncedEmails($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getBouncedEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index | [optional] [default to 0] | +| **size** | **int**| Optional page size | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageBouncedEmail**](../Model/PageBouncedEmail) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getBouncedRecipient()` + +```php +getBouncedRecipient($id): \MailSlurp\Models\BouncedRecipientDto +``` + +Get a bounced email. + +Bounced emails are email you have sent that were rejected by a recipient + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of the bounced recipient + +try { + $result = $apiInstance->getBouncedRecipient($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getBouncedRecipient: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of the bounced recipient | | + +### Return type + +[**\MailSlurp\Models\BouncedRecipientDto**](../Model/BouncedRecipientDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getBouncedRecipients()` + +```php +getBouncedRecipients($page, $size, $sort, $since, $before): \MailSlurp\Models\PageBouncedRecipients +``` + +Get paginated list of bounced recipients. + +Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index +$size = 20; // int | Optional page size +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getBouncedRecipients($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getBouncedRecipients: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index | [optional] [default to 0] | +| **size** | **int**| Optional page size | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageBouncedRecipients**](../Model/PageBouncedRecipients) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getComplaints()` + +```php +getComplaints($page, $size, $sort, $since, $before): \MailSlurp\Models\PageComplaint +``` + +Get paginated list of complaints. + +SMTP complaints made against your account + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index +$size = 20; // int | Optional page size +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getComplaints($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getComplaints: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index | [optional] [default to 0] | +| **size** | **int**| Optional page size | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageComplaint**](../Model/PageComplaint) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getListUnsubscribeRecipients()` + +```php +getListUnsubscribeRecipients($page, $size, $sort, $domain_id): \MailSlurp\Models\PageListUnsubscribeRecipients +``` + +Get paginated list of unsubscribed recipients. + +Unsubscribed recipient have unsubscribed from a mailing list for a user or domain and cannot be contacted again. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BounceControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index +$size = 20; // int | Optional page size +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$domain_id = 'domain_id_example'; // string | Filter by domainId + +try { + $result = $apiInstance->getListUnsubscribeRecipients($page, $size, $sort, $domain_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BounceControllerApi->getListUnsubscribeRecipients: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index | [optional] [default to 0] | +| **size** | **int**| Optional page size | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **domain_id** | **string**| Filter by domainId | [optional] | + +### Return type + +[**\MailSlurp\Models\PageListUnsubscribeRecipients**](../Model/PageListUnsubscribeRecipients) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/BulkActionsControllerApi.md b/docs/Api/BulkActionsControllerApi.md new file mode 100644 index 00000000..8b6bc02a --- /dev/null +++ b/docs/Api/BulkActionsControllerApi.md @@ -0,0 +1,188 @@ +# MailSlurp\BulkActionsControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**bulkCreateInboxes()**](BulkActionsControllerApi#bulkCreateInboxes) | **POST** /bulk/inboxes | Bulk create Inboxes (email addresses) | +| [**bulkDeleteInboxes()**](BulkActionsControllerApi#bulkDeleteInboxes) | **DELETE** /bulk/inboxes | Bulk Delete Inboxes | +| [**bulkSendEmails()**](BulkActionsControllerApi#bulkSendEmails) | **POST** /bulk/send | Bulk Send Emails | + + +## `bulkCreateInboxes()` + +```php +bulkCreateInboxes($count): \MailSlurp\Models\InboxDto[] +``` + +Bulk create Inboxes (email addresses) + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BulkActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$count = 56; // int | Number of inboxes to be created in bulk + +try { + $result = $apiInstance->bulkCreateInboxes($count); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BulkActionsControllerApi->bulkCreateInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **count** | **int**| Number of inboxes to be created in bulk | | + +### Return type + +[**\MailSlurp\Models\InboxDto[]**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `bulkDeleteInboxes()` + +```php +bulkDeleteInboxes($request_body) +``` + +Bulk Delete Inboxes + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BulkActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$request_body = array('request_body_example'); // string[] + +try { + $apiInstance->bulkDeleteInboxes($request_body); +} catch (Exception $e) { + echo 'Exception when calling BulkActionsControllerApi->bulkDeleteInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **request_body** | [**string[]**](../Model/string)| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `bulkSendEmails()` + +```php +bulkSendEmails($bulk_send_email_options) +``` + +Bulk Send Emails + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\BulkActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$bulk_send_email_options = new \MailSlurp\Models\BulkSendEmailOptions(); // \MailSlurp\Models\BulkSendEmailOptions + +try { + $apiInstance->bulkSendEmails($bulk_send_email_options); +} catch (Exception $e) { + echo 'Exception when calling BulkActionsControllerApi->bulkSendEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **bulk_send_email_options** | [**\MailSlurp\Models\BulkSendEmailOptions**](../Model/BulkSendEmailOptions)| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/CommonActionsControllerApi.md b/docs/Api/CommonActionsControllerApi.md new file mode 100644 index 00000000..525c2c53 --- /dev/null +++ b/docs/Api/CommonActionsControllerApi.md @@ -0,0 +1,363 @@ +# MailSlurp\CommonActionsControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createNewEmailAddress()**](CommonActionsControllerApi#createNewEmailAddress) | **POST** /newEmailAddress | Create new random inbox | +| [**createRandomInbox()**](CommonActionsControllerApi#createRandomInbox) | **POST** /createInbox | Create new random inbox | +| [**deleteEmailAddress()**](CommonActionsControllerApi#deleteEmailAddress) | **DELETE** /deleteEmailAddress | Delete inbox email address by inbox id | +| [**emptyInbox()**](CommonActionsControllerApi#emptyInbox) | **DELETE** /emptyInbox | Delete all emails in an inbox | +| [**sendEmailSimple()**](CommonActionsControllerApi#sendEmailSimple) | **POST** /sendEmail | Send an email | + + +## `createNewEmailAddress()` + +```php +createNewEmailAddress($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address): \MailSlurp\Models\InboxDto +``` + +Create new random inbox + +Returns an Inbox with an `id` and an `emailAddress` + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\CommonActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$allow_team_access = True; // bool +$use_domain_pool = True; // bool +$expires_at = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime +$expires_in = 56; // int +$email_address = 'email_address_example'; // string +$inbox_type = 'inbox_type_example'; // string +$description = 'description_example'; // string +$name = 'name_example'; // string +$tags = array('tags_example'); // string[] +$favourite = True; // bool +$virtual_inbox = True; // bool +$use_short_address = True; // bool + +try { + $result = $apiInstance->createNewEmailAddress($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CommonActionsControllerApi->createNewEmailAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **allow_team_access** | **bool**| | [optional] | +| **use_domain_pool** | **bool**| | [optional] | +| **expires_at** | **\DateTime**| | [optional] | +| **expires_in** | **int**| | [optional] | +| **email_address** | **string**| | [optional] | +| **inbox_type** | **string**| | [optional] | +| **description** | **string**| | [optional] | +| **name** | **string**| | [optional] | +| **tags** | [**string[]**](../Model/string)| | [optional] | +| **favourite** | **bool**| | [optional] | +| **virtual_inbox** | **bool**| | [optional] | +| **use_short_address** | **bool**| | [optional] | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createRandomInbox()` + +```php +createRandomInbox($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address): \MailSlurp\Models\InboxDto +``` + +Create new random inbox + +Returns an Inbox with an `id` and an `emailAddress` + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\CommonActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$allow_team_access = True; // bool +$use_domain_pool = True; // bool +$expires_at = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime +$expires_in = 56; // int +$email_address = 'email_address_example'; // string +$inbox_type = 'inbox_type_example'; // string +$description = 'description_example'; // string +$name = 'name_example'; // string +$tags = array('tags_example'); // string[] +$favourite = True; // bool +$virtual_inbox = True; // bool +$use_short_address = True; // bool + +try { + $result = $apiInstance->createRandomInbox($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CommonActionsControllerApi->createRandomInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **allow_team_access** | **bool**| | [optional] | +| **use_domain_pool** | **bool**| | [optional] | +| **expires_at** | **\DateTime**| | [optional] | +| **expires_in** | **int**| | [optional] | +| **email_address** | **string**| | [optional] | +| **inbox_type** | **string**| | [optional] | +| **description** | **string**| | [optional] | +| **name** | **string**| | [optional] | +| **tags** | [**string[]**](../Model/string)| | [optional] | +| **favourite** | **bool**| | [optional] | +| **virtual_inbox** | **bool**| | [optional] | +| **use_short_address** | **bool**| | [optional] | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteEmailAddress()` + +```php +deleteEmailAddress($inbox_id) +``` + +Delete inbox email address by inbox id + +Deletes inbox email address + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\CommonActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $apiInstance->deleteEmailAddress($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling CommonActionsControllerApi->deleteEmailAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `emptyInbox()` + +```php +emptyInbox($inbox_id) +``` + +Delete all emails in an inbox + +Deletes all emails + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\CommonActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $apiInstance->emptyInbox($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling CommonActionsControllerApi->emptyInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendEmailSimple()` + +```php +sendEmailSimple($simple_send_email_options) +``` + +Send an email + +If no senderId or inboxId provided a random email address will be used to send from. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\CommonActionsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$simple_send_email_options = new \MailSlurp\Models\SimpleSendEmailOptions(); // \MailSlurp\Models\SimpleSendEmailOptions + +try { + $apiInstance->sendEmailSimple($simple_send_email_options); +} catch (Exception $e) { + echo 'Exception when calling CommonActionsControllerApi->sendEmailSimple: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **simple_send_email_options** | [**\MailSlurp\Models\SimpleSendEmailOptions**](../Model/SimpleSendEmailOptions)| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/ContactControllerApi.md b/docs/Api/ContactControllerApi.md new file mode 100644 index 00000000..e2d95cb8 --- /dev/null +++ b/docs/Api/ContactControllerApi.md @@ -0,0 +1,377 @@ +# MailSlurp\ContactControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createContact()**](ContactControllerApi#createContact) | **POST** /contacts | Create a contact | +| [**deleteContact()**](ContactControllerApi#deleteContact) | **DELETE** /contacts/{contactId} | Delete contact | +| [**getAllContacts()**](ContactControllerApi#getAllContacts) | **GET** /contacts/paginated | Get all contacts | +| [**getContact()**](ContactControllerApi#getContact) | **GET** /contacts/{contactId} | Get contact | +| [**getContactVCard()**](ContactControllerApi#getContactVCard) | **GET** /contacts/{contactId}/download | Get contact vCard vcf file | +| [**getContacts()**](ContactControllerApi#getContacts) | **GET** /contacts | Get all contacts | + + +## `createContact()` + +```php +createContact($create_contact_options): \MailSlurp\Models\ContactDto +``` + +Create a contact + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_contact_options = new \MailSlurp\Models\CreateContactOptions(); // \MailSlurp\Models\CreateContactOptions + +try { + $result = $apiInstance->createContact($create_contact_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->createContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_contact_options** | [**\MailSlurp\Models\CreateContactOptions**](../Model/CreateContactOptions)| | | + +### Return type + +[**\MailSlurp\Models\ContactDto**](../Model/ContactDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteContact()` + +```php +deleteContact($contact_id) +``` + +Delete contact + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contact_id = 'contact_id_example'; // string + +try { + $apiInstance->deleteContact($contact_id); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->deleteContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contact_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllContacts()` + +```php +getAllContacts($page, $size, $sort, $since, $before): \MailSlurp\Models\PageContactProjection +``` + +Get all contacts + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllContacts($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->getAllContacts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageContactProjection**](../Model/PageContactProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getContact()` + +```php +getContact($contact_id): \MailSlurp\Models\ContactDto +``` + +Get contact + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contact_id = 'contact_id_example'; // string + +try { + $result = $apiInstance->getContact($contact_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->getContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contact_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\ContactDto**](../Model/ContactDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getContactVCard()` + +```php +getContactVCard($contact_id): string[] +``` + +Get contact vCard vcf file + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contact_id = 'contact_id_example'; // string + +try { + $result = $apiInstance->getContactVCard($contact_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->getContactVCard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contact_id** | **string**| | | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getContacts()` + +```php +getContacts(): \MailSlurp\Models\ContactProjection[] +``` + +Get all contacts + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ContactControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getContacts(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactControllerApi->getContacts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\ContactProjection[]**](../Model/ContactProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/DomainControllerApi.md b/docs/Api/DomainControllerApi.md new file mode 100644 index 00000000..39dc8be7 --- /dev/null +++ b/docs/Api/DomainControllerApi.md @@ -0,0 +1,447 @@ +# MailSlurp\DomainControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addDomainWildcardCatchAll()**](DomainControllerApi#addDomainWildcardCatchAll) | **POST** /domains/{id}/wildcard | Add catch all wild card inbox to domain | +| [**createDomain()**](DomainControllerApi#createDomain) | **POST** /domains | Create Domain | +| [**deleteDomain()**](DomainControllerApi#deleteDomain) | **DELETE** /domains/{id} | Delete a domain | +| [**getDomain()**](DomainControllerApi#getDomain) | **GET** /domains/{id} | Get a domain | +| [**getDomainWildcardCatchAllInbox()**](DomainControllerApi#getDomainWildcardCatchAllInbox) | **GET** /domains/{id}/wildcard | Get catch all wild card inbox for domain | +| [**getDomains()**](DomainControllerApi#getDomains) | **GET** /domains | Get domains | +| [**updateDomain()**](DomainControllerApi#updateDomain) | **PUT** /domains/{id} | Update a domain | + + +## `addDomainWildcardCatchAll()` + +```php +addDomainWildcardCatchAll($id): \MailSlurp\Models\DomainDto +``` + +Add catch all wild card inbox to domain + +Add a catch all inbox to a domain so that any emails sent to it that cannot be matched will be sent to the catch all inbox generated + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->addDomainWildcardCatchAll($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->addDomainWildcardCatchAll: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\DomainDto**](../Model/DomainDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createDomain()` + +```php +createDomain($create_domain_options): \MailSlurp\Models\DomainDto +``` + +Create Domain + +Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider's DNS setup to verify the domain. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_domain_options = new \MailSlurp\Models\CreateDomainOptions(); // \MailSlurp\Models\CreateDomainOptions + +try { + $result = $apiInstance->createDomain($create_domain_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->createDomain: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_domain_options** | [**\MailSlurp\Models\CreateDomainOptions**](../Model/CreateDomainOptions)| | | + +### Return type + +[**\MailSlurp\Models\DomainDto**](../Model/DomainDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteDomain()` + +```php +deleteDomain($id): string[] +``` + +Delete a domain + +Delete a domain. This will disable any existing inboxes that use this domain. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->deleteDomain($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->deleteDomain: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getDomain()` + +```php +getDomain($id): \MailSlurp\Models\DomainDto +``` + +Get a domain + +Returns domain verification status and tokens for a given domain + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getDomain($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->getDomain: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\DomainDto**](../Model/DomainDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getDomainWildcardCatchAllInbox()` + +```php +getDomainWildcardCatchAllInbox($id): \MailSlurp\Models\InboxDto +``` + +Get catch all wild card inbox for domain + +Get the catch all inbox for a domain for missed emails + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getDomainWildcardCatchAllInbox($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->getDomainWildcardCatchAllInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getDomains()` + +```php +getDomains(): \MailSlurp\Models\DomainPreview[] +``` + +Get domains + +List all custom domains you have created + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getDomains(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->getDomains: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\DomainPreview[]**](../Model/DomainPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateDomain()` + +```php +updateDomain($id, $update_domain_options): \MailSlurp\Models\DomainDto +``` + +Update a domain + +Update values on a domain. Note you cannot change the domain name as it is immutable. Recreate the domain if you need to alter this. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\DomainControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string +$update_domain_options = new \MailSlurp\Models\UpdateDomainOptions(); // \MailSlurp\Models\UpdateDomainOptions + +try { + $result = $apiInstance->updateDomain($id, $update_domain_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainControllerApi->updateDomain: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **update_domain_options** | [**\MailSlurp\Models\UpdateDomainOptions**](../Model/UpdateDomainOptions)| | | + +### Return type + +[**\MailSlurp\Models\DomainDto**](../Model/DomainDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/EmailControllerApi.md b/docs/Api/EmailControllerApi.md new file mode 100644 index 00000000..3067638d --- /dev/null +++ b/docs/Api/EmailControllerApi.md @@ -0,0 +1,2012 @@ +# MailSlurp\EmailControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**applyImapFlagOperation()**](EmailControllerApi#applyImapFlagOperation) | **POST** /emails/{emailId}/imap-flag-operation | Set IMAP flags associated with a message. Only supports '\\Seen' flag. | +| [**deleteAllEmails()**](EmailControllerApi#deleteAllEmails) | **DELETE** /emails | Delete all emails in all inboxes. | +| [**deleteEmail()**](EmailControllerApi#deleteEmail) | **DELETE** /emails/{emailId} | Delete an email | +| [**downloadAttachment()**](EmailControllerApi#downloadAttachment) | **GET** /emails/{emailId}/attachments/{attachmentId} | Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. | +| [**downloadAttachmentBase64()**](EmailControllerApi#downloadAttachmentBase64) | **GET** /emails/{emailId}/attachments/{attachmentId}/base64 | Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. | +| [**downloadBody()**](EmailControllerApi#downloadBody) | **GET** /emails/{emailId}/body | Get email body as string. Returned as `plain/text` with content type header. | +| [**downloadBodyBytes()**](EmailControllerApi#downloadBodyBytes) | **GET** /emails/{emailId}/body-bytes | Get email body in bytes. Returned as `octet-stream` with content type header. | +| [**forwardEmail()**](EmailControllerApi#forwardEmail) | **POST** /emails/{emailId}/forward | Forward email to recipients | +| [**getAttachmentMetaData()**](EmailControllerApi#getAttachmentMetaData) | **GET** /emails/{emailId}/attachments/{attachmentId}/metadata | Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. | +| [**getEmail()**](EmailControllerApi#getEmail) | **GET** /emails/{emailId} | Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. | +| [**getEmailAttachments()**](EmailControllerApi#getEmailAttachments) | **GET** /emails/{emailId}/attachments | Get all email attachment metadata. Metadata includes name and size of attachments. | +| [**getEmailContentMatch()**](EmailControllerApi#getEmailContentMatch) | **POST** /emails/{emailId}/contentMatch | Get email content regex pattern match results. Runs regex against email body and returns match groups. | +| [**getEmailCount()**](EmailControllerApi#getEmailCount) | **GET** /emails/emails/count | Get email count | +| [**getEmailHTML()**](EmailControllerApi#getEmailHTML) | **GET** /emails/{emailId}/html | Get email content as HTML. For displaying emails in browser context. | +| [**getEmailHTMLJson()**](EmailControllerApi#getEmailHTMLJson) | **GET** /emails/{emailId}/html/json | Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content | +| [**getEmailHTMLQuery()**](EmailControllerApi#getEmailHTMLQuery) | **GET** /emails/{emailId}/htmlQuery | Parse and return text from an email, stripping HTML and decoding encoded characters | +| [**getEmailLinks()**](EmailControllerApi#getEmailLinks) | **GET** /emails/{emailId}/links | Parse and return list of links found in an email (only works for HTML content) | +| [**getEmailPreviewURLs()**](EmailControllerApi#getEmailPreviewURLs) | **GET** /emails/{emailId}/urls | Get email URLs for viewing in browser or downloading | +| [**getEmailTextLines()**](EmailControllerApi#getEmailTextLines) | **GET** /emails/{emailId}/textLines | Parse and return text from an email, stripping HTML and decoding encoded characters | +| [**getEmailsPaginated()**](EmailControllerApi#getEmailsPaginated) | **GET** /emails | Get all emails in all inboxes in paginated form. Email API list all. | +| [**getGravatarUrlForEmailAddress()**](EmailControllerApi#getGravatarUrlForEmailAddress) | **GET** /emails/gravatarFor | | +| [**getLatestEmail()**](EmailControllerApi#getLatestEmail) | **GET** /emails/latest | Get latest email in all inboxes. Most recently received. | +| [**getLatestEmailInInbox1()**](EmailControllerApi#getLatestEmailInInbox1) | **GET** /emails/latestIn | Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. | +| [**getOrganizationEmailsPaginated()**](EmailControllerApi#getOrganizationEmailsPaginated) | **GET** /emails/organization | Get all organization emails. List team or shared test email accounts | +| [**getRawEmailContents()**](EmailControllerApi#getRawEmailContents) | **GET** /emails/{emailId}/raw | Get raw email string. Returns unparsed raw SMTP message with headers and body. | +| [**getRawEmailJson()**](EmailControllerApi#getRawEmailJson) | **GET** /emails/{emailId}/raw/json | Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. | +| [**getUnreadEmailCount()**](EmailControllerApi#getUnreadEmailCount) | **GET** /emails/unreadCount | Get unread email count | +| [**markAsRead()**](EmailControllerApi#markAsRead) | **PATCH** /emails/{emailId}/read | Mark an email as read on unread | +| [**replyToEmail()**](EmailControllerApi#replyToEmail) | **PUT** /emails/{emailId} | Reply to an email | +| [**sendEmailSourceOptional()**](EmailControllerApi#sendEmailSourceOptional) | **POST** /emails | Send email | +| [**validateEmail()**](EmailControllerApi#validateEmail) | **POST** /emails/{emailId}/validate | Validate email HTML contents | + + +## `applyImapFlagOperation()` + +```php +applyImapFlagOperation($email_id, $imap_flag_operation_options): \MailSlurp\Models\EmailPreview +``` + +Set IMAP flags associated with a message. Only supports '\\Seen' flag. + +Apply RFC3501 section-2.3.2 IMAP flag operations on an email + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string +$imap_flag_operation_options = new \MailSlurp\Models\ImapFlagOperationOptions(); // \MailSlurp\Models\ImapFlagOperationOptions + +try { + $result = $apiInstance->applyImapFlagOperation($email_id, $imap_flag_operation_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->applyImapFlagOperation: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | +| **imap_flag_operation_options** | [**\MailSlurp\Models\ImapFlagOperationOptions**](../Model/ImapFlagOperationOptions)| | | + +### Return type + +[**\MailSlurp\Models\EmailPreview**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAllEmails()` + +```php +deleteAllEmails() +``` + +Delete all emails in all inboxes. + +Deletes all emails in your account. Be careful as emails cannot be recovered + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->deleteAllEmails(); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->deleteAllEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteEmail()` + +```php +deleteEmail($email_id) +``` + +Delete an email + +Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email to delete + +try { + $apiInstance->deleteEmail($email_id); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->deleteEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email to delete | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadAttachment()` + +```php +downloadAttachment($email_id, $attachment_id, $api_key): string +``` + +Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. + +Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email +$attachment_id = 'attachment_id_example'; // string | ID of attachment +$api_key = 'api_key_example'; // string | Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. + +try { + $result = $apiInstance->downloadAttachment($email_id, $attachment_id, $api_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->downloadAttachment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | +| **attachment_id** | **string**| ID of attachment | | +| **api_key** | **string**| Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. | [optional] | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadAttachmentBase64()` + +```php +downloadAttachmentBase64($email_id, $attachment_id): \MailSlurp\Models\DownloadAttachmentDto +``` + +Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. + +Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->downloadAttachmentBase64($email_id, $attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->downloadAttachmentBase64: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +[**\MailSlurp\Models\DownloadAttachmentDto**](../Model/DownloadAttachmentDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadBody()` + +```php +downloadBody($email_id): string +``` + +Get email body as string. Returned as `plain/text` with content type header. + +Returns the specified email body for a given email as a string + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->downloadBody($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->downloadBody: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/plain`, `text/html` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `downloadBodyBytes()` + +```php +downloadBodyBytes($email_id): string +``` + +Get email body in bytes. Returned as `octet-stream` with content type header. + +Returns the specified email body for a given email as a stream / array of bytes. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->downloadBodyBytes($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->downloadBodyBytes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `forwardEmail()` + +```php +forwardEmail($email_id, $forward_email_options): \MailSlurp\Models\SentEmailDto +``` + +Forward email to recipients + +Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email +$forward_email_options = new \MailSlurp\Models\ForwardEmailOptions(); // \MailSlurp\Models\ForwardEmailOptions + +try { + $result = $apiInstance->forwardEmail($email_id, $forward_email_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->forwardEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | +| **forward_email_options** | [**\MailSlurp\Models\ForwardEmailOptions**](../Model/ForwardEmailOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAttachmentMetaData()` + +```php +getAttachmentMetaData($email_id, $attachment_id): \MailSlurp\Models\AttachmentMetaData +``` + +Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. + +Returns the metadata such as name and content-type for a given attachment and email. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email +$attachment_id = 'attachment_id_example'; // string | ID of attachment + +try { + $result = $apiInstance->getAttachmentMetaData($email_id, $attachment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getAttachmentMetaData: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | +| **attachment_id** | **string**| ID of attachment | | + +### Return type + +[**\MailSlurp\Models\AttachmentMetaData**](../Model/AttachmentMetaData) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmail()` + +```php +getEmail($email_id, $decode): \MailSlurp\Models\Email +``` + +Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. + +Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string +$decode = false; // bool | Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing + +try { + $result = $apiInstance->getEmail($email_id, $decode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | +| **decode** | **bool**| Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing | [optional] [default to false] | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailAttachments()` + +```php +getEmailAttachments($email_id): \MailSlurp\Models\AttachmentMetaData[] +``` + +Get all email attachment metadata. Metadata includes name and size of attachments. + +Returns an array of attachment metadata such as name and content-type for a given email if present. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->getEmailAttachments($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailAttachments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +[**\MailSlurp\Models\AttachmentMetaData[]**](../Model/AttachmentMetaData) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailContentMatch()` + +```php +getEmailContentMatch($email_id, $content_match_options): \MailSlurp\Models\EmailContentMatchResult +``` + +Get email content regex pattern match results. Runs regex against email body and returns match groups. + +Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email to match against +$content_match_options = new \MailSlurp\Models\ContentMatchOptions(); // \MailSlurp\Models\ContentMatchOptions + +try { + $result = $apiInstance->getEmailContentMatch($email_id, $content_match_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailContentMatch: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email to match against | | +| **content_match_options** | [**\MailSlurp\Models\ContentMatchOptions**](../Model/ContentMatchOptions)| | | + +### Return type + +[**\MailSlurp\Models\EmailContentMatchResult**](../Model/EmailContentMatchResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailCount()` + +```php +getEmailCount(): \MailSlurp\Models\CountDto +``` + +Get email count + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getEmailCount(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\CountDto**](../Model/CountDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailHTML()` + +```php +getEmailHTML($email_id, $decode): string +``` + +Get email content as HTML. For displaying emails in browser context. + +Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx`. Returns content-type `text/html;charset=utf-8` so you must call expecting that content response not JSON. For JSON response see the `getEmailHTMLJson` method. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string +$decode = false; // bool + +try { + $result = $apiInstance->getEmailHTML($email_id, $decode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailHTML: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | +| **decode** | **bool**| | [optional] [default to false] | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/html;charset=utf-8`, `text/html` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailHTMLJson()` + +```php +getEmailHTMLJson($email_id, $decode): \MailSlurp\Models\EmailHtmlDto +``` + +Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content + +Retrieve email content as HTML response. Decodes quoted-printable entities and converts charset to UTF-8. Returns content-type `application/json;charset=utf-8` so you must call expecting that content response not JSON. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string +$decode = false; // bool + +try { + $result = $apiInstance->getEmailHTMLJson($email_id, $decode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailHTMLJson: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | +| **decode** | **bool**| | [optional] [default to false] | + +### Return type + +[**\MailSlurp\Models\EmailHtmlDto**](../Model/EmailHtmlDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailHTMLQuery()` + +```php +getEmailHTMLQuery($email_id, $html_selector): \MailSlurp\Models\EmailTextLinesResult +``` + +Parse and return text from an email, stripping HTML and decoding encoded characters + +Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email to perform HTML query on +$html_selector = 'html_selector_example'; // string | HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. + +try { + $result = $apiInstance->getEmailHTMLQuery($email_id, $html_selector); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailHTMLQuery: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email to perform HTML query on | | +| **html_selector** | **string**| HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. | | + +### Return type + +[**\MailSlurp\Models\EmailTextLinesResult**](../Model/EmailTextLinesResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailLinks()` + +```php +getEmailLinks($email_id): \MailSlurp\Models\EmailLinksResult +``` + +Parse and return list of links found in an email (only works for HTML content) + +HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email to fetch text for + +try { + $result = $apiInstance->getEmailLinks($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailLinks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email to fetch text for | | + +### Return type + +[**\MailSlurp\Models\EmailLinksResult**](../Model/EmailLinksResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailPreviewURLs()` + +```php +getEmailPreviewURLs($email_id): \MailSlurp\Models\EmailPreviewUrls +``` + +Get email URLs for viewing in browser or downloading + +Get a list of URLs for email content as text/html or raw SMTP message for viewing the message in a browser. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string + +try { + $result = $apiInstance->getEmailPreviewURLs($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailPreviewURLs: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\EmailPreviewUrls**](../Model/EmailPreviewUrls) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailTextLines()` + +```php +getEmailTextLines($email_id, $decode_html_entities, $line_separator): \MailSlurp\Models\EmailTextLinesResult +``` + +Parse and return text from an email, stripping HTML and decoding encoded characters + +Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email to fetch text for +$decode_html_entities = True; // bool | Decode HTML entities +$line_separator = 'line_separator_example'; // string | Line separator character + +try { + $result = $apiInstance->getEmailTextLines($email_id, $decode_html_entities, $line_separator); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailTextLines: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email to fetch text for | | +| **decode_html_entities** | **bool**| Decode HTML entities | [optional] | +| **line_separator** | **string**| Line separator character | [optional] | + +### Return type + +[**\MailSlurp\Models\EmailTextLinesResult**](../Model/EmailTextLinesResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmailsPaginated()` + +```php +getEmailsPaginated($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before): \MailSlurp\Models\PageEmailProjection +``` + +Get all emails in all inboxes in paginated form. Email API list all. + +By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = array('inbox_id_example'); // string[] | Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. +$page = 0; // int | Optional page index in email list pagination +$size = 20; // int | Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$unread_only = false; // bool | Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly +$search_filter = 'search_filter_example'; // string | Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter emails received after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter emails received before given date time + +try { + $result = $apiInstance->getEmailsPaginated($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getEmailsPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | [**string[]**](../Model/string)| Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. | [optional] | +| **page** | **int**| Optional page index in email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **unread_only** | **bool**| Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly | [optional] [default to false] | +| **search_filter** | **string**| Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body | [optional] | +| **since** | **\DateTime**| Optional filter emails received after given date time | [optional] | +| **before** | **\DateTime**| Optional filter emails received before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageEmailProjection**](../Model/PageEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getGravatarUrlForEmailAddress()` + +```php +getGravatarUrlForEmailAddress($email_address, $size): \MailSlurp\Models\GravatarUrl +``` + + + +Get gravatar url for email address + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_address = 'email_address_example'; // string +$size = 'size_example'; // string + +try { + $result = $apiInstance->getGravatarUrlForEmailAddress($email_address, $size); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getGravatarUrlForEmailAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_address** | **string**| | | +| **size** | **string**| | [optional] | + +### Return type + +[**\MailSlurp\Models\GravatarUrl**](../Model/GravatarUrl) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getLatestEmail()` + +```php +getLatestEmail($inbox_ids): \MailSlurp\Models\Email +``` + +Get latest email in all inboxes. Most recently received. + +Get the newest email in all inboxes or in a passed set of inbox IDs + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_ids = array('inbox_ids_example'); // string[] | Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes + +try { + $result = $apiInstance->getLatestEmail($inbox_ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getLatestEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_ids** | [**string[]**](../Model/string)| Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes | [optional] | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getLatestEmailInInbox1()` + +```php +getLatestEmailInInbox1($inbox_id): \MailSlurp\Models\Email +``` + +Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + +Get the newest email in all inboxes or in a passed set of inbox IDs + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to get the latest email from + +try { + $result = $apiInstance->getLatestEmailInInbox1($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getLatestEmailInInbox1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to get the latest email from | | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getOrganizationEmailsPaginated()` + +```php +getOrganizationEmailsPaginated($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before): \MailSlurp\Models\PageEmailProjection +``` + +Get all organization emails. List team or shared test email accounts + +By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = array('inbox_id_example'); // string[] | Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. +$page = 0; // int | Optional page index in email list pagination +$size = 20; // int | Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$unread_only = false; // bool | Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly +$search_filter = 'search_filter_example'; // string | Optional search filter search filter for emails. +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter emails received after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter emails received before given date time + +try { + $result = $apiInstance->getOrganizationEmailsPaginated($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getOrganizationEmailsPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | [**string[]**](../Model/string)| Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. | [optional] | +| **page** | **int**| Optional page index in email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **unread_only** | **bool**| Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly | [optional] [default to false] | +| **search_filter** | **string**| Optional search filter search filter for emails. | [optional] | +| **since** | **\DateTime**| Optional filter emails received after given date time | [optional] | +| **before** | **\DateTime**| Optional filter emails received before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageEmailProjection**](../Model/PageEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getRawEmailContents()` + +```php +getRawEmailContents($email_id): string +``` + +Get raw email string. Returns unparsed raw SMTP message with headers and body. + +Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->getRawEmailContents($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getRawEmailContents: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/plain` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getRawEmailJson()` + +```php +getRawEmailJson($email_id): \MailSlurp\Models\RawEmailJson +``` + +Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. + +Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->getRawEmailJson($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getRawEmailJson: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +[**\MailSlurp\Models\RawEmailJson**](../Model/RawEmailJson) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getUnreadEmailCount()` + +```php +getUnreadEmailCount(): \MailSlurp\Models\UnreadCount +``` + +Get unread email count + +Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getUnreadEmailCount(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->getUnreadEmailCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\UnreadCount**](../Model/UnreadCount) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `markAsRead()` + +```php +markAsRead($email_id, $read): \MailSlurp\Models\EmailPreview +``` + +Mark an email as read on unread + +Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string +$read = true; // bool | What value to assign to email read property. Default true. + +try { + $result = $apiInstance->markAsRead($email_id, $read); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->markAsRead: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| | | +| **read** | **bool**| What value to assign to email read property. Default true. | [optional] [default to true] | + +### Return type + +[**\MailSlurp\Models\EmailPreview**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `replyToEmail()` + +```php +replyToEmail($email_id, $reply_to_email_options): \MailSlurp\Models\SentEmailDto +``` + +Reply to an email + +Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of the email that should be replied to +$reply_to_email_options = new \MailSlurp\Models\ReplyToEmailOptions(); // \MailSlurp\Models\ReplyToEmailOptions + +try { + $result = $apiInstance->replyToEmail($email_id, $reply_to_email_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->replyToEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of the email that should be replied to | | +| **reply_to_email_options** | [**\MailSlurp\Models\ReplyToEmailOptions**](../Model/ReplyToEmailOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendEmailSourceOptional()` + +```php +sendEmailSourceOptional($send_email_options, $inbox_id, $use_domain_pool, $virtual_send) +``` + +Send email + +Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$use_domain_pool = True; // bool | Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. +$virtual_send = True; // bool | Optionally create inbox to send from that is a virtual inbox and won't send to external addresses + +try { + $apiInstance->sendEmailSourceOptional($send_email_options, $inbox_id, $use_domain_pool, $virtual_send); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->sendEmailSourceOptional: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | [optional] | +| **use_domain_pool** | **bool**| Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. | [optional] | +| **virtual_send** | **bool**| Optionally create inbox to send from that is a virtual inbox and won't send to external addresses | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `validateEmail()` + +```php +validateEmail($email_id): \MailSlurp\Models\ValidationDto +``` + +Validate email HTML contents + +Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->validateEmail($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailControllerApi->validateEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +[**\MailSlurp\Models\ValidationDto**](../Model/ValidationDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/EmailVerificationControllerApi.md b/docs/Api/EmailVerificationControllerApi.md new file mode 100644 index 00000000..bbfad39b --- /dev/null +++ b/docs/Api/EmailVerificationControllerApi.md @@ -0,0 +1,141 @@ +# MailSlurp\EmailVerificationControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getValidationRequests()**](EmailVerificationControllerApi#getValidationRequests) | **GET** /email-verification/validation-requests | Validate a list of email addresses. Per unit billing. See your plan for pricing. | +| [**validateEmailAddressList()**](EmailVerificationControllerApi#validateEmailAddressList) | **POST** /email-verification/email-address-list | Validate a list of email addresses. Per unit billing. See your plan for pricing. | + + +## `getValidationRequests()` + +```php +getValidationRequests($page, $size, $sort, $search_filter, $since, $before, $is_valid): \MailSlurp\Models\PageEmailValidationRequest +``` + +Validate a list of email addresses. Per unit billing. See your plan for pricing. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailVerificationControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size for paginated result list. +$sort = 'DESC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp +$is_valid = True; // bool | Filter where email is valid is true or false + +try { + $result = $apiInstance->getValidationRequests($page, $size, $sort, $search_filter, $since, $before, $is_valid); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailVerificationControllerApi->getValidationRequests: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size for paginated result list. | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'DESC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | +| **is_valid** | **bool**| Filter where email is valid is true or false | [optional] | + +### Return type + +[**\MailSlurp\Models\PageEmailValidationRequest**](../Model/PageEmailValidationRequest) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `validateEmailAddressList()` + +```php +validateEmailAddressList($validate_email_address_list_options): \MailSlurp\Models\ValidateEmailAddressListResult +``` + +Validate a list of email addresses. Per unit billing. See your plan for pricing. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\EmailVerificationControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$validate_email_address_list_options = new \MailSlurp\Models\ValidateEmailAddressListOptions(); // \MailSlurp\Models\ValidateEmailAddressListOptions + +try { + $result = $apiInstance->validateEmailAddressList($validate_email_address_list_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EmailVerificationControllerApi->validateEmailAddressList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validate_email_address_list_options** | [**\MailSlurp\Models\ValidateEmailAddressListOptions**](../Model/ValidateEmailAddressListOptions)| | | + +### Return type + +[**\MailSlurp\Models\ValidateEmailAddressListResult**](../Model/ValidateEmailAddressListResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/ExpiredControllerApi.md b/docs/Api/ExpiredControllerApi.md new file mode 100644 index 00000000..81978c04 --- /dev/null +++ b/docs/Api/ExpiredControllerApi.md @@ -0,0 +1,264 @@ +# MailSlurp\ExpiredControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getExpirationDefaults()**](ExpiredControllerApi#getExpirationDefaults) | **GET** /expired/defaults | Get default expiration settings | +| [**getExpiredInboxByInboxId()**](ExpiredControllerApi#getExpiredInboxByInboxId) | **GET** /expired/inbox/{inboxId} | Get expired inbox record for a previously existing inbox | +| [**getExpiredInboxRecord()**](ExpiredControllerApi#getExpiredInboxRecord) | **GET** /expired/{expiredId} | Get an expired inbox record | +| [**getExpiredInboxes()**](ExpiredControllerApi#getExpiredInboxes) | **GET** /expired | List records of expired inboxes | + + +## `getExpirationDefaults()` + +```php +getExpirationDefaults(): \MailSlurp\Models\ExpirationDefaults +``` + +Get default expiration settings + +Return default times used for inbox expiration + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExpiredControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getExpirationDefaults(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExpiredControllerApi->getExpirationDefaults: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\ExpirationDefaults**](../Model/ExpirationDefaults) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getExpiredInboxByInboxId()` + +```php +getExpiredInboxByInboxId($inbox_id): \MailSlurp\Models\ExpiredInboxDto +``` + +Get expired inbox record for a previously existing inbox + +Use the inboxId to return an ExpiredInboxRecord if an inbox has expired. Inboxes expire and are disabled if an expiration date is set or plan requires. Returns 404 if no expired inbox is found for the inboxId + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExpiredControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of inbox you want to retrieve (not the inbox ID) + +try { + $result = $apiInstance->getExpiredInboxByInboxId($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExpiredControllerApi->getExpiredInboxByInboxId: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of inbox you want to retrieve (not the inbox ID) | | + +### Return type + +[**\MailSlurp\Models\ExpiredInboxDto**](../Model/ExpiredInboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getExpiredInboxRecord()` + +```php +getExpiredInboxRecord($expired_id): \MailSlurp\Models\ExpiredInboxDto +``` + +Get an expired inbox record + +Inboxes created with an expiration date will expire after the given date and be moved to an ExpiredInbox entity. You can still read emails in the inbox but it can no longer send or receive emails. Fetch the expired inboxes to view the old inboxes properties + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExpiredControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$expired_id = 'expired_id_example'; // string | ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId + +try { + $result = $apiInstance->getExpiredInboxRecord($expired_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExpiredControllerApi->getExpiredInboxRecord: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **expired_id** | **string**| ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId | | + +### Return type + +[**\MailSlurp\Models\ExpiredInboxDto**](../Model/ExpiredInboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getExpiredInboxes()` + +```php +getExpiredInboxes($page, $size, $sort, $since, $before): \MailSlurp\Models\PageExpiredInboxRecordProjection +``` + +List records of expired inboxes + +Inboxes created with an expiration date will expire after the given date. An ExpiredInboxRecord is created that records the inboxes old ID and email address. You can still read emails in the inbox (using the inboxes old ID) but the email address associated with the inbox can no longer send or receive emails. Fetch expired inbox records to view the old inboxes properties + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExpiredControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in inbox sent email list pagination +$size = 20; // int | Optional page size in inbox sent email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getExpiredInboxes($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExpiredControllerApi->getExpiredInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in inbox sent email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox sent email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageExpiredInboxRecordProjection**](../Model/PageExpiredInboxRecordProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/ExportControllerApi.md b/docs/Api/ExportControllerApi.md new file mode 100644 index 00000000..a0a1f5b7 --- /dev/null +++ b/docs/Api/ExportControllerApi.md @@ -0,0 +1,147 @@ +# MailSlurp\ExportControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**exportEntities()**](ExportControllerApi#exportEntities) | **GET** /export | Export inboxes link callable via browser | +| [**getExportLink()**](ExportControllerApi#getExportLink) | **POST** /export | Get export link | + + +## `exportEntities()` + +```php +exportEntities($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time): string[] +``` + +Export inboxes link callable via browser + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExportControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$export_type = 'export_type_example'; // string +$api_key = 'api_key_example'; // string +$output_format = 'output_format_example'; // string +$filter = 'filter_example'; // string +$list_separator_token = 'list_separator_token_example'; // string +$exclude_previously_exported = True; // bool +$created_earliest_time = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime +$created_oldest_time = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime + +try { + $result = $apiInstance->exportEntities($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportControllerApi->exportEntities: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **export_type** | **string**| | | +| **api_key** | **string**| | | +| **output_format** | **string**| | | +| **filter** | **string**| | [optional] | +| **list_separator_token** | **string**| | [optional] | +| **exclude_previously_exported** | **bool**| | [optional] | +| **created_earliest_time** | **\DateTime**| | [optional] | +| **created_oldest_time** | **\DateTime**| | [optional] | + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getExportLink()` + +```php +getExportLink($export_type, $export_options, $api_key): \MailSlurp\Models\ExportLink +``` + +Get export link + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\ExportControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$export_type = 'export_type_example'; // string +$export_options = new \MailSlurp\Models\ExportOptions(); // \MailSlurp\Models\ExportOptions +$api_key = 'api_key_example'; // string + +try { + $result = $apiInstance->getExportLink($export_type, $export_options, $api_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportControllerApi->getExportLink: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **export_type** | **string**| | | +| **export_options** | [**\MailSlurp\Models\ExportOptions**](../Model/ExportOptions)| | | +| **api_key** | **string**| | [optional] | + +### Return type + +[**\MailSlurp\Models\ExportLink**](../Model/ExportLink) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/FormControllerApi.md b/docs/Api/FormControllerApi.md new file mode 100644 index 00000000..e5d69976 --- /dev/null +++ b/docs/Api/FormControllerApi.md @@ -0,0 +1,82 @@ +# MailSlurp\FormControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**submitForm()**](FormControllerApi#submitForm) | **POST** /forms | Submit a form to be parsed and sent as an email to an address determined by the form fields | + + +## `submitForm()` + +```php +submitForm($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters): string +``` + +Submit a form to be parsed and sent as an email to an address determined by the form fields + +This endpoint allows you to submit HTML forms and receive the field values and files via email. #### Parameters The endpoint looks for special meta parameters in the form fields OR in the URL request parameters. The meta parameters can be used to specify the behaviour of the email. You must provide at-least a `_to` email address to tell the endpoint where the form should be emailed. These can be submitted as hidden HTML input fields with the corresponding `name` attributes or as URL query parameters such as `?_to=test@example.com` The endpoint takes all other form fields that are named and includes them in the message body of the email. Files are sent as attachments. #### Submitting This endpoint accepts form submission via POST method. It accepts `application/x-www-form-urlencoded`, and `multipart/form-data` content-types. #### HTML Example ```html
``` #### URL Example ```html
``` The email address is specified by a `_to` field OR is extracted from an email alias specified by a `_toAlias` field (see the alias controller for more information). Endpoint accepts . You can specify a content type in HTML forms using the `enctype` attribute, for instance: `
`. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\FormControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$_to = test@example.com; // string | The email address that submitted form should be sent to. +$_subject = My form submission; // string | Optional subject of the email that will be sent. +$_redirect_to = https://mysite.com/form-success; // string | Optional URL to redirect form submitter to after submission. If not present user will see a success message. +$_email_address = test@example.com; // string | Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. +$_success_message = Thanks for submitting; // string | Optional success message to display if no _redirectTo present. +$_spam_check = '_spam_check_example'; // string | Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. +$other_parameters = 'other_parameters_example'; // string | All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. + +try { + $result = $apiInstance->submitForm($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FormControllerApi->submitForm: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **_to** | **string**| The email address that submitted form should be sent to. | [optional] | +| **_subject** | **string**| Optional subject of the email that will be sent. | [optional] | +| **_redirect_to** | **string**| Optional URL to redirect form submitter to after submission. If not present user will see a success message. | [optional] | +| **_email_address** | **string**| Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. | [optional] | +| **_success_message** | **string**| Optional success message to display if no _redirectTo present. | [optional] | +| **_spam_check** | **string**| Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. | [optional] | +| **other_parameters** | **string**| All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. | [optional] | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/GroupControllerApi.md b/docs/Api/GroupControllerApi.md new file mode 100644 index 00000000..80acfabc --- /dev/null +++ b/docs/Api/GroupControllerApi.md @@ -0,0 +1,576 @@ +# MailSlurp\GroupControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addContactsToGroup()**](GroupControllerApi#addContactsToGroup) | **PUT** /groups/{groupId}/contacts | Add contacts to a group | +| [**createGroup()**](GroupControllerApi#createGroup) | **POST** /groups | Create a group | +| [**deleteGroup()**](GroupControllerApi#deleteGroup) | **DELETE** /groups/{groupId} | Delete group | +| [**getAllGroups()**](GroupControllerApi#getAllGroups) | **GET** /groups/paginated | Get all Contact Groups in paginated format | +| [**getGroup()**](GroupControllerApi#getGroup) | **GET** /groups/{groupId} | Get group | +| [**getGroupWithContacts()**](GroupControllerApi#getGroupWithContacts) | **GET** /groups/{groupId}/contacts | Get group and contacts belonging to it | +| [**getGroupWithContactsPaginated()**](GroupControllerApi#getGroupWithContactsPaginated) | **GET** /groups/{groupId}/contacts-paginated | | +| [**getGroups()**](GroupControllerApi#getGroups) | **GET** /groups | Get all groups | +| [**removeContactsFromGroup()**](GroupControllerApi#removeContactsFromGroup) | **DELETE** /groups/{groupId}/contacts | Remove contacts from a group | + + +## `addContactsToGroup()` + +```php +addContactsToGroup($group_id, $update_group_contacts): \MailSlurp\Models\GroupContactsDto +``` + +Add contacts to a group + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string +$update_group_contacts = new \MailSlurp\Models\UpdateGroupContacts(); // \MailSlurp\Models\UpdateGroupContacts + +try { + $result = $apiInstance->addContactsToGroup($group_id, $update_group_contacts); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->addContactsToGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | +| **update_group_contacts** | [**\MailSlurp\Models\UpdateGroupContacts**](../Model/UpdateGroupContacts)| | | + +### Return type + +[**\MailSlurp\Models\GroupContactsDto**](../Model/GroupContactsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createGroup()` + +```php +createGroup($create_group_options): \MailSlurp\Models\GroupDto +``` + +Create a group + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_group_options = new \MailSlurp\Models\CreateGroupOptions(); // \MailSlurp\Models\CreateGroupOptions + +try { + $result = $apiInstance->createGroup($create_group_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->createGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_group_options** | [**\MailSlurp\Models\CreateGroupOptions**](../Model/CreateGroupOptions)| | | + +### Return type + +[**\MailSlurp\Models\GroupDto**](../Model/GroupDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteGroup()` + +```php +deleteGroup($group_id) +``` + +Delete group + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string + +try { + $apiInstance->deleteGroup($group_id); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->deleteGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllGroups()` + +```php +getAllGroups($page, $size, $sort, $since, $before): \MailSlurp\Models\PageGroupProjection +``` + +Get all Contact Groups in paginated format + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllGroups($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->getAllGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageGroupProjection**](../Model/PageGroupProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getGroup()` + +```php +getGroup($group_id): \MailSlurp\Models\GroupDto +``` + +Get group + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string + +try { + $result = $apiInstance->getGroup($group_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->getGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\GroupDto**](../Model/GroupDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getGroupWithContacts()` + +```php +getGroupWithContacts($group_id): \MailSlurp\Models\GroupContactsDto +``` + +Get group and contacts belonging to it + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string + +try { + $result = $apiInstance->getGroupWithContacts($group_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->getGroupWithContacts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\GroupContactsDto**](../Model/GroupContactsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getGroupWithContactsPaginated()` + +```php +getGroupWithContactsPaginated($group_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageContactProjection +``` + + + +Get group and paginated contacts belonging to it + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string +$page = 0; // int | Optional page index in group contact pagination +$size = 20; // int | Optional page size in group contact pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getGroupWithContactsPaginated($group_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->getGroupWithContactsPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | +| **page** | **int**| Optional page index in group contact pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in group contact pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageContactProjection**](../Model/PageContactProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getGroups()` + +```php +getGroups(): \MailSlurp\Models\GroupProjection[] +``` + +Get all groups + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getGroups(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->getGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\GroupProjection[]**](../Model/GroupProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `removeContactsFromGroup()` + +```php +removeContactsFromGroup($group_id, $update_group_contacts): \MailSlurp\Models\GroupContactsDto +``` + +Remove contacts from a group + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\GroupControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_id = 'group_id_example'; // string +$update_group_contacts = new \MailSlurp\Models\UpdateGroupContacts(); // \MailSlurp\Models\UpdateGroupContacts + +try { + $result = $apiInstance->removeContactsFromGroup($group_id, $update_group_contacts); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupControllerApi->removeContactsFromGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_id** | **string**| | | +| **update_group_contacts** | [**\MailSlurp\Models\UpdateGroupContacts**](../Model/UpdateGroupContacts)| | | + +### Return type + +[**\MailSlurp\Models\GroupContactsDto**](../Model/GroupContactsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/InboxControllerApi.md b/docs/Api/InboxControllerApi.md new file mode 100644 index 00000000..34dc0f89 --- /dev/null +++ b/docs/Api/InboxControllerApi.md @@ -0,0 +1,2615 @@ +# MailSlurp\InboxControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelScheduledJob()**](InboxControllerApi#cancelScheduledJob) | **DELETE** /inboxes/scheduled-jobs/{jobId} | Cancel a scheduled email job | +| [**createInbox()**](InboxControllerApi#createInbox) | **POST** /inboxes | Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. | +| [**createInboxRuleset()**](InboxControllerApi#createInboxRuleset) | **POST** /inboxes/{inboxId}/rulesets | Create an inbox ruleset | +| [**createInboxWithDefaults()**](InboxControllerApi#createInboxWithDefaults) | **POST** /inboxes/withDefaults | Create an inbox with default options. Uses MailSlurp domain pool address and is private. | +| [**createInboxWithOptions()**](InboxControllerApi#createInboxWithOptions) | **POST** /inboxes/withOptions | Create an inbox with options. Extended options for inbox creation. | +| [**deleteAllInboxEmails()**](InboxControllerApi#deleteAllInboxEmails) | **DELETE** /inboxes/{inboxId}/deleteAllInboxEmails | Delete all emails in a given inboxes. | +| [**deleteAllInboxes()**](InboxControllerApi#deleteAllInboxes) | **DELETE** /inboxes | Delete all inboxes | +| [**deleteInbox()**](InboxControllerApi#deleteInbox) | **DELETE** /inboxes/{inboxId} | Delete inbox | +| [**doesInboxExist()**](InboxControllerApi#doesInboxExist) | **GET** /inboxes/exists | Does inbox exist | +| [**flushExpired()**](InboxControllerApi#flushExpired) | **DELETE** /inboxes/expired | Remove expired inboxes | +| [**getAllInboxes()**](InboxControllerApi#getAllInboxes) | **GET** /inboxes/paginated | List All Inboxes Paginated | +| [**getAllScheduledJobs()**](InboxControllerApi#getAllScheduledJobs) | **GET** /inboxes/scheduled-jobs | Get all scheduled email sending jobs for account | +| [**getDeliveryStatusesByInboxId()**](InboxControllerApi#getDeliveryStatusesByInboxId) | **GET** /inboxes/{inboxId}/delivery-status | | +| [**getEmails()**](InboxControllerApi#getEmails) | **GET** /inboxes/{inboxId}/emails | Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. | +| [**getImapSmtpAccess()**](InboxControllerApi#getImapSmtpAccess) | **GET** /inboxes/imap-smtp-access | | +| [**getInbox()**](InboxControllerApi#getInbox) | **GET** /inboxes/{inboxId} | Get Inbox. Returns properties of an inbox. | +| [**getInboxByEmailAddress()**](InboxControllerApi#getInboxByEmailAddress) | **GET** /inboxes/byEmailAddress | Search for an inbox with the provided email address | +| [**getInboxByName()**](InboxControllerApi#getInboxByName) | **GET** /inboxes/byName | Search for an inbox with the given name | +| [**getInboxCount()**](InboxControllerApi#getInboxCount) | **GET** /inboxes/count | Get total inbox count | +| [**getInboxEmailCount()**](InboxControllerApi#getInboxEmailCount) | **GET** /inboxes/{inboxId}/emails/count | Get email count in inbox | +| [**getInboxEmailsPaginated()**](InboxControllerApi#getInboxEmailsPaginated) | **GET** /inboxes/{inboxId}/emails/paginated | Get inbox emails paginated | +| [**getInboxIds()**](InboxControllerApi#getInboxIds) | **GET** /inboxes/ids | Get all inbox IDs | +| [**getInboxSentEmails()**](InboxControllerApi#getInboxSentEmails) | **GET** /inboxes/{inboxId}/sent | Get Inbox Sent Emails | +| [**getInboxTags()**](InboxControllerApi#getInboxTags) | **GET** /inboxes/tags | Get inbox tags | +| [**getInboxes()**](InboxControllerApi#getInboxes) | **GET** /inboxes | List Inboxes and email addresses | +| [**getLatestEmailInInbox()**](InboxControllerApi#getLatestEmailInInbox) | **GET** /inboxes/getLatestEmail | Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. | +| [**getOrganizationInboxes()**](InboxControllerApi#getOrganizationInboxes) | **GET** /inboxes/organization | List Organization Inboxes Paginated | +| [**getScheduledJob()**](InboxControllerApi#getScheduledJob) | **GET** /inboxes/scheduled-jobs/{jobId} | Get a scheduled email job | +| [**getScheduledJobsByInboxId()**](InboxControllerApi#getScheduledJobsByInboxId) | **GET** /inboxes/{inboxId}/scheduled-jobs | Get all scheduled email sending jobs for the inbox | +| [**listInboxRulesets()**](InboxControllerApi#listInboxRulesets) | **GET** /inboxes/{inboxId}/rulesets | List inbox rulesets | +| [**listInboxTrackingPixels()**](InboxControllerApi#listInboxTrackingPixels) | **GET** /inboxes/{inboxId}/tracking-pixels | List inbox tracking pixels | +| [**sendEmail()**](InboxControllerApi#sendEmail) | **POST** /inboxes/{inboxId} | Send Email | +| [**sendEmailAndConfirm()**](InboxControllerApi#sendEmailAndConfirm) | **POST** /inboxes/{inboxId}/confirm | Send email and return sent confirmation | +| [**sendEmailWithQueue()**](InboxControllerApi#sendEmailWithQueue) | **POST** /inboxes/{inboxId}/with-queue | Send email with queue | +| [**sendSmtpEnvelope()**](InboxControllerApi#sendSmtpEnvelope) | **POST** /inboxes/{inboxId}/smtp-envelope | Send email using an SMTP mail envelope and message body and return sent confirmation | +| [**sendTestEmail()**](InboxControllerApi#sendTestEmail) | **POST** /inboxes/{inboxId}/send-test-email | Send a test email to inbox | +| [**sendWithSchedule()**](InboxControllerApi#sendWithSchedule) | **POST** /inboxes/{inboxId}/with-schedule | Send email with with delay or schedule | +| [**setInboxFavourited()**](InboxControllerApi#setInboxFavourited) | **PUT** /inboxes/{inboxId}/favourite | Set inbox favourited state | +| [**updateInbox()**](InboxControllerApi#updateInbox) | **PATCH** /inboxes/{inboxId} | Update Inbox. Change name and description. Email address is not editable. | + + +## `cancelScheduledJob()` + +```php +cancelScheduledJob($job_id): \MailSlurp\Models\ScheduledJobDto +``` + +Cancel a scheduled email job + +Get a scheduled email job and cancel it. Will fail if status of job is already cancelled, failed, or complete. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job_id = 'job_id_example'; // string + +try { + $result = $apiInstance->cancelScheduledJob($job_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->cancelScheduledJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\ScheduledJobDto**](../Model/ScheduledJobDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createInbox()` + +```php +createInbox($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address): \MailSlurp\Models\InboxDto +``` + +Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. + +Create a new inbox and with a randomized email address to send and receive from. Pass emailAddress parameter if you wish to use a specific email address. Creating an inbox is required before sending or receiving emails. If writing tests it is recommended that you create a new inbox during each test method so that it is unique and empty. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_address = 'email_address_example'; // string | A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. +$tags = array('tags_example'); // string[] | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. +$name = 'name_example'; // string | Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. +$description = 'description_example'; // string | Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with +$use_domain_pool = True; // bool | Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. +$favourite = True; // bool | Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering +$expires_at = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. +$expires_in = 56; // int | Number of milliseconds that inbox should exist for +$allow_team_access = True; // bool | DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. +$inbox_type = 'inbox_type_example'; // string | HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. +$virtual_inbox = True; // bool | Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. +$use_short_address = True; // bool | Use a shorter email address under 31 characters + +try { + $result = $apiInstance->createInbox($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->createInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_address** | **string**| A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. | [optional] | +| **tags** | [**string[]**](../Model/string)| Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] | +| **name** | **string**| Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. | [optional] | +| **description** | **string**| Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with | [optional] | +| **use_domain_pool** | **bool**| Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. | [optional] | +| **favourite** | **bool**| Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering | [optional] | +| **expires_at** | **\DateTime**| Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. | [optional] | +| **expires_in** | **int**| Number of milliseconds that inbox should exist for | [optional] | +| **allow_team_access** | **bool**| DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. | [optional] | +| **inbox_type** | **string**| HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. | [optional] | +| **virtual_inbox** | **bool**| Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. | [optional] | +| **use_short_address** | **bool**| Use a shorter email address under 31 characters | [optional] | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createInboxRuleset()` + +```php +createInboxRuleset($inbox_id, $create_inbox_ruleset_options): \MailSlurp\Models\InboxRulesetDto +``` + +Create an inbox ruleset + +Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | inboxId +$create_inbox_ruleset_options = new \MailSlurp\Models\CreateInboxRulesetOptions(); // \MailSlurp\Models\CreateInboxRulesetOptions + +try { + $result = $apiInstance->createInboxRuleset($inbox_id, $create_inbox_ruleset_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->createInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| inboxId | | +| **create_inbox_ruleset_options** | [**\MailSlurp\Models\CreateInboxRulesetOptions**](../Model/CreateInboxRulesetOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetDto**](../Model/InboxRulesetDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createInboxWithDefaults()` + +```php +createInboxWithDefaults(): \MailSlurp\Models\InboxDto +``` + +Create an inbox with default options. Uses MailSlurp domain pool address and is private. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->createInboxWithDefaults(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->createInboxWithDefaults: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createInboxWithOptions()` + +```php +createInboxWithOptions($create_inbox_dto): \MailSlurp\Models\InboxDto +``` + +Create an inbox with options. Extended options for inbox creation. + +Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_inbox_dto = new \MailSlurp\Models\CreateInboxDto(); // \MailSlurp\Models\CreateInboxDto + +try { + $result = $apiInstance->createInboxWithOptions($create_inbox_dto); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->createInboxWithOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_inbox_dto** | [**\MailSlurp\Models\CreateInboxDto**](../Model/CreateInboxDto)| | | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAllInboxEmails()` + +```php +deleteAllInboxEmails($inbox_id) +``` + +Delete all emails in a given inboxes. + +Deletes all emails in an inbox. Be careful as emails cannot be recovered + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $apiInstance->deleteAllInboxEmails($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->deleteAllInboxEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAllInboxes()` + +```php +deleteAllInboxes() +``` + +Delete all inboxes + +Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->deleteAllInboxes(); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->deleteAllInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteInbox()` + +```php +deleteInbox($inbox_id) +``` + +Delete inbox + +Permanently delete an inbox and associated email address as well as all emails within the given inbox. This action cannot be undone. Note: deleting an inbox will not affect your account usage. Monthly inbox usage is based on how many inboxes you create within 30 days, not how many exist at time of request. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $apiInstance->deleteInbox($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->deleteInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `doesInboxExist()` + +```php +doesInboxExist($email_address, $allow_catch_all): \MailSlurp\Models\InboxExistsDto +``` + +Does inbox exist + +Check if inboxes exist by email address. Useful if you are sending emails to mailslurp addresses + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_address = 'email_address_example'; // string | Email address +$allow_catch_all = True; // bool + +try { + $result = $apiInstance->doesInboxExist($email_address, $allow_catch_all); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->doesInboxExist: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_address** | **string**| Email address | | +| **allow_catch_all** | **bool**| | [optional] | + +### Return type + +[**\MailSlurp\Models\InboxExistsDto**](../Model/InboxExistsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `flushExpired()` + +```php +flushExpired($before): \MailSlurp\Models\FlushExpiredInboxesResult +``` + +Remove expired inboxes + +Remove any expired inboxes for your account (instead of waiting for scheduled removal on server) + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional expired at before flag to flush expired inboxes that have expired before the given time + +try { + $result = $apiInstance->flushExpired($before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->flushExpired: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **before** | **\DateTime**| Optional expired at before flag to flush expired inboxes that have expired before the given time | [optional] | + +### Return type + +[**\MailSlurp\Models\FlushExpiredInboxesResult**](../Model/FlushExpiredInboxesResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllInboxes()` + +```php +getAllInboxes($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id): \MailSlurp\Models\PageInboxProjection +``` + +List All Inboxes Paginated + +List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$favourite = false; // bool | Optionally filter results for favourites only +$search = 'search_example'; // string | Optionally filter by search words partial matching ID, tags, name, and email address +$tag = 'tag_example'; // string | Optionally filter by tags. Will return inboxes that include given tags +$team_access = True; // bool | DEPRECATED. Optionally filter by team access. +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created before given date time +$inbox_type = 'inbox_type_example'; // string | Optional filter by inbox type +$domain_id = 'domain_id_example'; // string | Optional domain ID filter + +try { + $result = $apiInstance->getAllInboxes($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getAllInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **favourite** | **bool**| Optionally filter results for favourites only | [optional] [default to false] | +| **search** | **string**| Optionally filter by search words partial matching ID, tags, name, and email address | [optional] | +| **tag** | **string**| Optionally filter by tags. Will return inboxes that include given tags | [optional] | +| **team_access** | **bool**| DEPRECATED. Optionally filter by team access. | [optional] | +| **since** | **\DateTime**| Optional filter by created after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by created before given date time | [optional] | +| **inbox_type** | **string**| Optional filter by inbox type | [optional] | +| **domain_id** | **string**| Optional domain ID filter | [optional] | + +### Return type + +[**\MailSlurp\Models\PageInboxProjection**](../Model/PageInboxProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllScheduledJobs()` + +```php +getAllScheduledJobs($page, $size, $sort, $since, $before): \MailSlurp\Models\PageScheduledJobs +``` + +Get all scheduled email sending jobs for account + +Schedule sending of emails using scheduled jobs. These can be inbox or account level. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in scheduled job list pagination +$size = 20; // int | Optional page size in scheduled job list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllScheduledJobs($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getAllScheduledJobs: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in scheduled job list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in scheduled job list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageScheduledJobs**](../Model/PageScheduledJobs) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getDeliveryStatusesByInboxId()` + +```php +getDeliveryStatusesByInboxId($inbox_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageDeliveryStatus +``` + + + +Get all email delivery statuses for an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in delivery status list pagination +$size = 20; // int | Optional page size in delivery status list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getDeliveryStatusesByInboxId($inbox_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getDeliveryStatusesByInboxId: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in delivery status list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in delivery status list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageDeliveryStatus**](../Model/PageDeliveryStatus) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmails()` + +```php +getEmails($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since): \MailSlurp\Models\EmailPreview[] +``` + +Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. + +List emails that an inbox has received. Only emails that are sent to the inbox's email address will appear in the inbox. It may take several seconds for any email you send to an inbox's email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the `minCount` parameter. The server will retry the inbox database until the `minCount` is satisfied or the `retryTimeout` is reached + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of inbox that emails belongs to +$size = 56; // int | Alias for limit. Assessed first before assessing any passed limit. +$limit = 56; // int | Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller +$sort = 'sort_example'; // string | Sort the results by received date and direction ASC or DESC +$retry_timeout = 56; // int | Maximum milliseconds to spend retrying inbox database until minCount emails are returned +$delay_timeout = 56; // int +$min_count = 56; // int | Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. +$unread_only = True; // bool +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Exclude emails received after this ISO 8601 date time +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Exclude emails received before this ISO 8601 date time + +try { + $result = $apiInstance->getEmails($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of inbox that emails belongs to | | +| **size** | **int**| Alias for limit. Assessed first before assessing any passed limit. | [optional] | +| **limit** | **int**| Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller | [optional] | +| **sort** | **string**| Sort the results by received date and direction ASC or DESC | [optional] | +| **retry_timeout** | **int**| Maximum milliseconds to spend retrying inbox database until minCount emails are returned | [optional] | +| **delay_timeout** | **int**| | [optional] | +| **min_count** | **int**| Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. | [optional] | +| **unread_only** | **bool**| | [optional] | +| **before** | **\DateTime**| Exclude emails received after this ISO 8601 date time | [optional] | +| **since** | **\DateTime**| Exclude emails received before this ISO 8601 date time | [optional] | + +### Return type + +[**\MailSlurp\Models\EmailPreview[]**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getImapSmtpAccess()` + +```php +getImapSmtpAccess($inbox_id): \MailSlurp\Models\ImapSmtpAccessDetails +``` + + + +Get IMAP and SMTP access usernames and passwords + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Inbox ID + +try { + $result = $apiInstance->getImapSmtpAccess($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getImapSmtpAccess: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Inbox ID | [optional] | + +### Return type + +[**\MailSlurp\Models\ImapSmtpAccessDetails**](../Model/ImapSmtpAccessDetails) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInbox()` + +```php +getInbox($inbox_id): \MailSlurp\Models\InboxDto +``` + +Get Inbox. Returns properties of an inbox. + +Returns an inbox's properties, including its email address and ID. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $result = $apiInstance->getInbox($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxByEmailAddress()` + +```php +getInboxByEmailAddress($email_address): \MailSlurp\Models\InboxByEmailAddressResult +``` + +Search for an inbox with the provided email address + +Get a inbox result by email address + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_address = 'email_address_example'; // string + +try { + $result = $apiInstance->getInboxByEmailAddress($email_address); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxByEmailAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_address** | **string**| | | + +### Return type + +[**\MailSlurp\Models\InboxByEmailAddressResult**](../Model/InboxByEmailAddressResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxByName()` + +```php +getInboxByName($name): \MailSlurp\Models\InboxByNameResult +``` + +Search for an inbox with the given name + +Get a inbox result by name + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$name = 'name_example'; // string + +try { + $result = $apiInstance->getInboxByName($name); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxByName: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **name** | **string**| | | + +### Return type + +[**\MailSlurp\Models\InboxByNameResult**](../Model/InboxByNameResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxCount()` + +```php +getInboxCount(): \MailSlurp\Models\CountDto +``` + +Get total inbox count + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getInboxCount(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\CountDto**](../Model/CountDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxEmailCount()` + +```php +getInboxEmailCount($inbox_id): \MailSlurp\Models\CountDto +``` + +Get email count in inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of inbox that emails belongs to + +try { + $result = $apiInstance->getInboxEmailCount($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxEmailCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of inbox that emails belongs to | | + +### Return type + +[**\MailSlurp\Models\CountDto**](../Model/CountDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxEmailsPaginated()` + +```php +getInboxEmailsPaginated($inbox_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageEmailPreview +``` + +Get inbox emails paginated + +Get a paginated list of emails in an inbox. Does not hold connections open. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of inbox that emails belongs to +$page = 0; // int | Optional page index in inbox emails list pagination +$size = 20; // int | Optional page size in inbox emails list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by received after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by received before given date time + +try { + $result = $apiInstance->getInboxEmailsPaginated($inbox_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxEmailsPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of inbox that emails belongs to | | +| **page** | **int**| Optional page index in inbox emails list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox emails list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Optional filter by received after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by received before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageEmailPreview**](../Model/PageEmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxIds()` + +```php +getInboxIds(): \MailSlurp\Models\InboxIdsResult +``` + +Get all inbox IDs + +Get list of inbox IDs + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getInboxIds(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxIds: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\InboxIdsResult**](../Model/InboxIdsResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxSentEmails()` + +```php +getInboxSentEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageSentEmailProjection +``` + +Get Inbox Sent Emails + +Returns an inbox's sent email receipts. Call individual sent email endpoints for more details. Note for privacy reasons the full body of sent emails is never stored. An MD5 hash hex is available for comparison instead. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in inbox sent email list pagination +$size = 20; // int | Optional page size in inbox sent email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional sent email search +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by sent before given date time + +try { + $result = $apiInstance->getInboxSentEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxSentEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in inbox sent email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox sent email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional sent email search | [optional] | +| **since** | **\DateTime**| Optional filter by sent after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by sent before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageSentEmailProjection**](../Model/PageSentEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxTags()` + +```php +getInboxTags(): string[] +``` + +Get inbox tags + +Get all inbox tags + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getInboxTags(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxTags: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string[]** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxes()` + +```php +getInboxes($size, $sort, $since, $before): \MailSlurp\Models\InboxDto[] +``` + +List Inboxes and email addresses + +List the inboxes you have created. Note use of the more advanced `getAllInboxes` is recommended and allows paginated access using a limit and sort parameter. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$size = 100; // int | Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created before given date time + +try { + $result = $apiInstance->getInboxes($size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **size** | **int**| Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. | [optional] [default to 100] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Optional filter by created after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by created before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\InboxDto[]**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getLatestEmailInInbox()` + +```php +getLatestEmailInInbox($inbox_id, $timeout_millis): \MailSlurp\Models\Email +``` + +Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + +Get the newest email in an inbox or wait for one to arrive + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to get the latest email from +$timeout_millis = 56; // int | Timeout milliseconds to wait for latest email + +try { + $result = $apiInstance->getLatestEmailInInbox($inbox_id, $timeout_millis); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getLatestEmailInInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to get the latest email from | | +| **timeout_millis** | **int**| Timeout milliseconds to wait for latest email | | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getOrganizationInboxes()` + +```php +getOrganizationInboxes($page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageOrganizationInboxProjection +``` + +List Organization Inboxes Paginated + +List organization inboxes in paginated form. These are inboxes created with `allowTeamAccess` flag enabled. Organization inboxes are `readOnly` for non-admin users. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created before given date time + +try { + $result = $apiInstance->getOrganizationInboxes($page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getOrganizationInboxes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Optional filter by created after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by created before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageOrganizationInboxProjection**](../Model/PageOrganizationInboxProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getScheduledJob()` + +```php +getScheduledJob($job_id): \MailSlurp\Models\ScheduledJobDto +``` + +Get a scheduled email job + +Get a scheduled email job details. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job_id = 'job_id_example'; // string + +try { + $result = $apiInstance->getScheduledJob($job_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getScheduledJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\ScheduledJobDto**](../Model/ScheduledJobDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getScheduledJobsByInboxId()` + +```php +getScheduledJobsByInboxId($inbox_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageScheduledJobs +``` + +Get all scheduled email sending jobs for the inbox + +Schedule sending of emails using scheduled jobs. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in scheduled job list pagination +$size = 20; // int | Optional page size in scheduled job list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getScheduledJobsByInboxId($inbox_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->getScheduledJobsByInboxId: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in scheduled job list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in scheduled job list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageScheduledJobs**](../Model/PageScheduledJobs) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `listInboxRulesets()` + +```php +listInboxRulesets($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageInboxRulesetDto +``` + +List inbox rulesets + +List all rulesets attached to an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in inbox ruleset list pagination +$size = 20; // int | Optional page size in inbox ruleset list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created before given date time + +try { + $result = $apiInstance->listInboxRulesets($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->listInboxRulesets: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in inbox ruleset list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox ruleset list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Optional filter by created after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by created before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageInboxRulesetDto**](../Model/PageInboxRulesetDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `listInboxTrackingPixels()` + +```php +listInboxTrackingPixels($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageTrackingPixelProjection +``` + +List inbox tracking pixels + +List all tracking pixels sent from an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in inbox tracking pixel list pagination +$size = 20; // int | Optional page size in inbox tracking pixel list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter by created before given date time + +try { + $result = $apiInstance->listInboxTrackingPixels($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->listInboxTrackingPixels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in inbox tracking pixel list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox tracking pixel list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Optional filter by created after given date time | [optional] | +| **before** | **\DateTime**| Optional filter by created before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageTrackingPixelProjection**](../Model/PageTrackingPixelProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendEmail()` + +```php +sendEmail($inbox_id, $send_email_options) +``` + +Send Email + +Send an email from an inbox's email address. The request body should contain the `SendEmailOptions` that include recipients, attachments, body etc. See `SendEmailOptions` for all available properties. Note the `inboxId` refers to the inbox's id not the inbox's email address. See https://www.mailslurp.com/guides/ for more information on how to send emails. This method does not return a sent email entity due to legacy reasons. To send and get a sent email as returned response use the sister method `sendEmailAndConfirm`. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions + +try { + $apiInstance->sendEmail($inbox_id, $send_email_options); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendEmailAndConfirm()` + +```php +sendEmailAndConfirm($inbox_id, $send_email_options): \MailSlurp\Models\SentEmailDto +``` + +Send email and return sent confirmation + +Sister method for standard `sendEmail` method with the benefit of returning a `SentEmail` entity confirming the successful sending of the email with a link to the sent object created for it. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions + +try { + $result = $apiInstance->sendEmailAndConfirm($inbox_id, $send_email_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendEmailAndConfirm: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendEmailWithQueue()` + +```php +sendEmailWithQueue($inbox_id, $validate_before_enqueue, $send_email_options) +``` + +Send email with queue + +Send an email using a queue. Will place the email onto a queue that will then be processed and sent. Use this queue method to enable any failed email sending to be recovered. This will prevent lost emails when sending if your account encounters a block or payment issue. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$validate_before_enqueue = True; // bool | Validate before adding to queue +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions + +try { + $apiInstance->sendEmailWithQueue($inbox_id, $validate_before_enqueue, $send_email_options); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendEmailWithQueue: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | | +| **validate_before_enqueue** | **bool**| Validate before adding to queue | | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendSmtpEnvelope()` + +```php +sendSmtpEnvelope($inbox_id, $send_smtp_envelope_options): \MailSlurp\Models\SentEmailDto +``` + +Send email using an SMTP mail envelope and message body and return sent confirmation + +Send email using an SMTP envelope containing RCPT TO, MAIL FROM, and a SMTP BODY. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$send_smtp_envelope_options = new \MailSlurp\Models\SendSMTPEnvelopeOptions(); // \MailSlurp\Models\SendSMTPEnvelopeOptions + +try { + $result = $apiInstance->sendSmtpEnvelope($inbox_id, $send_smtp_envelope_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendSmtpEnvelope: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | | +| **send_smtp_envelope_options** | [**\MailSlurp\Models\SendSMTPEnvelopeOptions**](../Model/SendSMTPEnvelopeOptions)| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendTestEmail()` + +```php +sendTestEmail($inbox_id) +``` + +Send a test email to inbox + +Send an inbox a test email to test email receiving is working + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $apiInstance->sendTestEmail($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendTestEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendWithSchedule()` + +```php +sendWithSchedule($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue): \MailSlurp\Models\ScheduledJobDto +``` + +Send email with with delay or schedule + +Send an email using a delay. Will place the email onto a scheduler that will then be processed and sent. Use delays to schedule email sending. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of the inbox you want to send the email from +$send_email_options = new \MailSlurp\Models\SendEmailOptions(); // \MailSlurp\Models\SendEmailOptions +$send_at_timestamp = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Sending timestamp +$send_at_now_plus_seconds = 56; // int | Send after n seconds +$validate_before_enqueue = True; // bool | Validate before adding to queue + +try { + $result = $apiInstance->sendWithSchedule($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->sendWithSchedule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of the inbox you want to send the email from | | +| **send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](../Model/SendEmailOptions)| | | +| **send_at_timestamp** | **\DateTime**| Sending timestamp | [optional] | +| **send_at_now_plus_seconds** | **int**| Send after n seconds | [optional] | +| **validate_before_enqueue** | **bool**| Validate before adding to queue | [optional] | + +### Return type + +[**\MailSlurp\Models\ScheduledJobDto**](../Model/ScheduledJobDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `setInboxFavourited()` + +```php +setInboxFavourited($inbox_id, $set_inbox_favourited_options): \MailSlurp\Models\InboxDto +``` + +Set inbox favourited state + +Set and return new favourite state for an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of inbox to set favourite state +$set_inbox_favourited_options = new \MailSlurp\Models\SetInboxFavouritedOptions(); // \MailSlurp\Models\SetInboxFavouritedOptions + +try { + $result = $apiInstance->setInboxFavourited($inbox_id, $set_inbox_favourited_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->setInboxFavourited: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of inbox to set favourite state | | +| **set_inbox_favourited_options** | [**\MailSlurp\Models\SetInboxFavouritedOptions**](../Model/SetInboxFavouritedOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateInbox()` + +```php +updateInbox($inbox_id, $update_inbox_options): \MailSlurp\Models\InboxDto +``` + +Update Inbox. Change name and description. Email address is not editable. + +Update editable fields on an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$update_inbox_options = new \MailSlurp\Models\UpdateInboxOptions(); // \MailSlurp\Models\UpdateInboxOptions + +try { + $result = $apiInstance->updateInbox($inbox_id, $update_inbox_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxControllerApi->updateInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **update_inbox_options** | [**\MailSlurp\Models\UpdateInboxOptions**](../Model/UpdateInboxOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxDto**](../Model/InboxDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/InboxForwarderControllerApi.md b/docs/Api/InboxForwarderControllerApi.md new file mode 100644 index 00000000..f327957a --- /dev/null +++ b/docs/Api/InboxForwarderControllerApi.md @@ -0,0 +1,661 @@ +# MailSlurp\InboxForwarderControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createNewInboxForwarder()**](InboxForwarderControllerApi#createNewInboxForwarder) | **POST** /forwarders | Create an inbox forwarder | +| [**deleteInboxForwarder()**](InboxForwarderControllerApi#deleteInboxForwarder) | **DELETE** /forwarders/{id} | Delete an inbox forwarder | +| [**deleteInboxForwarders()**](InboxForwarderControllerApi#deleteInboxForwarders) | **DELETE** /forwarders | Delete inbox forwarders | +| [**getInboxForwarder()**](InboxForwarderControllerApi#getInboxForwarder) | **GET** /forwarders/{id} | Get an inbox forwarder | +| [**getInboxForwarderEvents()**](InboxForwarderControllerApi#getInboxForwarderEvents) | **GET** /forwarders/{id}/events | Get an inbox forwarder event list | +| [**getInboxForwarders()**](InboxForwarderControllerApi#getInboxForwarders) | **GET** /forwarders | List inbox forwarders | +| [**testInboxForwarder()**](InboxForwarderControllerApi#testInboxForwarder) | **POST** /forwarders/{id}/test | Test an inbox forwarder | +| [**testInboxForwardersForInbox()**](InboxForwarderControllerApi#testInboxForwardersForInbox) | **PUT** /forwarders | Test inbox forwarders for inbox | +| [**testNewInboxForwarder()**](InboxForwarderControllerApi#testNewInboxForwarder) | **PATCH** /forwarders | Test new inbox forwarder | +| [**updateInboxForwarder()**](InboxForwarderControllerApi#updateInboxForwarder) | **PUT** /forwarders/{id} | Update an inbox forwarder | + + +## `createNewInboxForwarder()` + +```php +createNewInboxForwarder($inbox_id, $create_inbox_forwarder_options): \MailSlurp\Models\InboxForwarderDto +``` + +Create an inbox forwarder + +Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Inbox id to attach forwarder to +$create_inbox_forwarder_options = new \MailSlurp\Models\CreateInboxForwarderOptions(); // \MailSlurp\Models\CreateInboxForwarderOptions + +try { + $result = $apiInstance->createNewInboxForwarder($inbox_id, $create_inbox_forwarder_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->createNewInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Inbox id to attach forwarder to | | +| **create_inbox_forwarder_options** | [**\MailSlurp\Models\CreateInboxForwarderOptions**](../Model/CreateInboxForwarderOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderDto**](../Model/InboxForwarderDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteInboxForwarder()` + +```php +deleteInboxForwarder($id) +``` + +Delete an inbox forwarder + +Delete inbox forwarder + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox forwarder + +try { + $apiInstance->deleteInboxForwarder($id); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->deleteInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox forwarder | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteInboxForwarders()` + +```php +deleteInboxForwarders($inbox_id) +``` + +Delete inbox forwarders + +Delete inbox forwarders. Accepts optional inboxId filter. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inbox id to attach forwarder to + +try { + $apiInstance->deleteInboxForwarders($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->deleteInboxForwarders: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inbox id to attach forwarder to | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxForwarder()` + +```php +getInboxForwarder($id): \MailSlurp\Models\InboxForwarderDto +``` + +Get an inbox forwarder + +Get inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox forwarder + +try { + $result = $apiInstance->getInboxForwarder($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->getInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox forwarder | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderDto**](../Model/InboxForwarderDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxForwarderEvents()` + +```php +getInboxForwarderEvents($id, $page, $size, $sort): \MailSlurp\Models\PageInboxForwarderEvents +``` + +Get an inbox forwarder event list + +Get inbox ruleset events + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox forwarder +$page = 0; // int | Optional page index in inbox forwarder event list pagination +$size = 20; // int | Optional page size in inbox forwarder event list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC + +try { + $result = $apiInstance->getInboxForwarderEvents($id, $page, $size, $sort); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->getInboxForwarderEvents: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox forwarder | | +| **page** | **int**| Optional page index in inbox forwarder event list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox forwarder event list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | + +### Return type + +[**\MailSlurp\Models\PageInboxForwarderEvents**](../Model/PageInboxForwarderEvents) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxForwarders()` + +```php +getInboxForwarders($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageInboxForwarderDto +``` + +List inbox forwarders + +List all forwarders attached to an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inbox id to get forwarders from +$page = 0; // int | Optional page index in inbox forwarder list pagination +$size = 20; // int | Optional page size in inbox forwarder list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getInboxForwarders($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->getInboxForwarders: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inbox id to get forwarders from | [optional] | +| **page** | **int**| Optional page index in inbox forwarder list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox forwarder list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageInboxForwarderDto**](../Model/PageInboxForwarderDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testInboxForwarder()` + +```php +testInboxForwarder($id, $inbox_forwarder_test_options): \MailSlurp\Models\InboxForwarderTestResult +``` + +Test an inbox forwarder + +Test an inbox forwarder + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox forwarder +$inbox_forwarder_test_options = new \MailSlurp\Models\InboxForwarderTestOptions(); // \MailSlurp\Models\InboxForwarderTestOptions + +try { + $result = $apiInstance->testInboxForwarder($id, $inbox_forwarder_test_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->testInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox forwarder | | +| **inbox_forwarder_test_options** | [**\MailSlurp\Models\InboxForwarderTestOptions**](../Model/InboxForwarderTestOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderTestResult**](../Model/InboxForwarderTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testInboxForwardersForInbox()` + +```php +testInboxForwardersForInbox($inbox_id, $inbox_forwarder_test_options): \MailSlurp\Models\InboxForwarderTestResult +``` + +Test inbox forwarders for inbox + +Test inbox forwarders for inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of inbox +$inbox_forwarder_test_options = new \MailSlurp\Models\InboxForwarderTestOptions(); // \MailSlurp\Models\InboxForwarderTestOptions + +try { + $result = $apiInstance->testInboxForwardersForInbox($inbox_id, $inbox_forwarder_test_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->testInboxForwardersForInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of inbox | | +| **inbox_forwarder_test_options** | [**\MailSlurp\Models\InboxForwarderTestOptions**](../Model/InboxForwarderTestOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderTestResult**](../Model/InboxForwarderTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testNewInboxForwarder()` + +```php +testNewInboxForwarder($test_new_inbox_forwarder_options): \MailSlurp\Models\InboxForwarderTestResult +``` + +Test new inbox forwarder + +Test new inbox forwarder + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$test_new_inbox_forwarder_options = new \MailSlurp\Models\TestNewInboxForwarderOptions(); // \MailSlurp\Models\TestNewInboxForwarderOptions + +try { + $result = $apiInstance->testNewInboxForwarder($test_new_inbox_forwarder_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->testNewInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **test_new_inbox_forwarder_options** | [**\MailSlurp\Models\TestNewInboxForwarderOptions**](../Model/TestNewInboxForwarderOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderTestResult**](../Model/InboxForwarderTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateInboxForwarder()` + +```php +updateInboxForwarder($id, $create_inbox_forwarder_options): \MailSlurp\Models\InboxForwarderDto +``` + +Update an inbox forwarder + +Update inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxForwarderControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox forwarder +$create_inbox_forwarder_options = new \MailSlurp\Models\CreateInboxForwarderOptions(); // \MailSlurp\Models\CreateInboxForwarderOptions + +try { + $result = $apiInstance->updateInboxForwarder($id, $create_inbox_forwarder_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxForwarderControllerApi->updateInboxForwarder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox forwarder | | +| **create_inbox_forwarder_options** | [**\MailSlurp\Models\CreateInboxForwarderOptions**](../Model/CreateInboxForwarderOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxForwarderDto**](../Model/InboxForwarderDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/InboxRulesetControllerApi.md b/docs/Api/InboxRulesetControllerApi.md new file mode 100644 index 00000000..7e264a22 --- /dev/null +++ b/docs/Api/InboxRulesetControllerApi.md @@ -0,0 +1,527 @@ +# MailSlurp\InboxRulesetControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createNewInboxRuleset()**](InboxRulesetControllerApi#createNewInboxRuleset) | **POST** /rulesets | Create an inbox ruleset | +| [**deleteInboxRuleset()**](InboxRulesetControllerApi#deleteInboxRuleset) | **DELETE** /rulesets/{id} | Delete an inbox ruleset | +| [**deleteInboxRulesets()**](InboxRulesetControllerApi#deleteInboxRulesets) | **DELETE** /rulesets | Delete inbox rulesets | +| [**getInboxRuleset()**](InboxRulesetControllerApi#getInboxRuleset) | **GET** /rulesets/{id} | Get an inbox ruleset | +| [**getInboxRulesets()**](InboxRulesetControllerApi#getInboxRulesets) | **GET** /rulesets | List inbox rulesets | +| [**testInboxRuleset()**](InboxRulesetControllerApi#testInboxRuleset) | **POST** /rulesets/{id}/test | Test an inbox ruleset | +| [**testInboxRulesetsForInbox()**](InboxRulesetControllerApi#testInboxRulesetsForInbox) | **PUT** /rulesets | Test inbox rulesets for inbox | +| [**testNewInboxRuleset()**](InboxRulesetControllerApi#testNewInboxRuleset) | **PATCH** /rulesets | Test new inbox ruleset | + + +## `createNewInboxRuleset()` + +```php +createNewInboxRuleset($inbox_id, $create_inbox_ruleset_options): \MailSlurp\Models\InboxRulesetDto +``` + +Create an inbox ruleset + +Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Inbox id to attach ruleset to +$create_inbox_ruleset_options = new \MailSlurp\Models\CreateInboxRulesetOptions(); // \MailSlurp\Models\CreateInboxRulesetOptions + +try { + $result = $apiInstance->createNewInboxRuleset($inbox_id, $create_inbox_ruleset_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->createNewInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Inbox id to attach ruleset to | | +| **create_inbox_ruleset_options** | [**\MailSlurp\Models\CreateInboxRulesetOptions**](../Model/CreateInboxRulesetOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetDto**](../Model/InboxRulesetDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteInboxRuleset()` + +```php +deleteInboxRuleset($id) +``` + +Delete an inbox ruleset + +Delete inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox ruleset + +try { + $apiInstance->deleteInboxRuleset($id); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->deleteInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox ruleset | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteInboxRulesets()` + +```php +deleteInboxRulesets($inbox_id) +``` + +Delete inbox rulesets + +Delete inbox rulesets. Accepts optional inboxId filter. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inbox id to attach ruleset to + +try { + $apiInstance->deleteInboxRulesets($inbox_id); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->deleteInboxRulesets: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inbox id to attach ruleset to | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxRuleset()` + +```php +getInboxRuleset($id): \MailSlurp\Models\InboxRulesetDto +``` + +Get an inbox ruleset + +Get inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox ruleset + +try { + $result = $apiInstance->getInboxRuleset($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->getInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox ruleset | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetDto**](../Model/InboxRulesetDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxRulesets()` + +```php +getInboxRulesets($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageInboxRulesetDto +``` + +List inbox rulesets + +List all rulesets attached to an inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inbox id to get rulesets from +$page = 0; // int | Optional page index in inbox ruleset list pagination +$size = 20; // int | Optional page size in inbox ruleset list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getInboxRulesets($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->getInboxRulesets: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inbox id to get rulesets from | [optional] | +| **page** | **int**| Optional page index in inbox ruleset list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox ruleset list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageInboxRulesetDto**](../Model/PageInboxRulesetDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testInboxRuleset()` + +```php +testInboxRuleset($id, $inbox_ruleset_test_options): \MailSlurp\Models\InboxRulesetTestResult +``` + +Test an inbox ruleset + +Test an inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string | ID of inbox ruleset +$inbox_ruleset_test_options = new \MailSlurp\Models\InboxRulesetTestOptions(); // \MailSlurp\Models\InboxRulesetTestOptions + +try { + $result = $apiInstance->testInboxRuleset($id, $inbox_ruleset_test_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->testInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| ID of inbox ruleset | | +| **inbox_ruleset_test_options** | [**\MailSlurp\Models\InboxRulesetTestOptions**](../Model/InboxRulesetTestOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetTestResult**](../Model/InboxRulesetTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testInboxRulesetsForInbox()` + +```php +testInboxRulesetsForInbox($inbox_id, $inbox_ruleset_test_options): \MailSlurp\Models\InboxRulesetTestResult +``` + +Test inbox rulesets for inbox + +Test inbox rulesets for inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | ID of inbox +$inbox_ruleset_test_options = new \MailSlurp\Models\InboxRulesetTestOptions(); // \MailSlurp\Models\InboxRulesetTestOptions + +try { + $result = $apiInstance->testInboxRulesetsForInbox($inbox_id, $inbox_ruleset_test_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->testInboxRulesetsForInbox: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| ID of inbox | | +| **inbox_ruleset_test_options** | [**\MailSlurp\Models\InboxRulesetTestOptions**](../Model/InboxRulesetTestOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetTestResult**](../Model/InboxRulesetTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testNewInboxRuleset()` + +```php +testNewInboxRuleset($test_new_inbox_ruleset_options): \MailSlurp\Models\InboxRulesetTestResult +``` + +Test new inbox ruleset + +Test new inbox ruleset + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\InboxRulesetControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$test_new_inbox_ruleset_options = new \MailSlurp\Models\TestNewInboxRulesetOptions(); // \MailSlurp\Models\TestNewInboxRulesetOptions + +try { + $result = $apiInstance->testNewInboxRuleset($test_new_inbox_ruleset_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InboxRulesetControllerApi->testNewInboxRuleset: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **test_new_inbox_ruleset_options** | [**\MailSlurp\Models\TestNewInboxRulesetOptions**](../Model/TestNewInboxRulesetOptions)| | | + +### Return type + +[**\MailSlurp\Models\InboxRulesetTestResult**](../Model/InboxRulesetTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/MailServerControllerApi.md b/docs/Api/MailServerControllerApi.md new file mode 100644 index 00000000..6490e4cf --- /dev/null +++ b/docs/Api/MailServerControllerApi.md @@ -0,0 +1,251 @@ +# MailSlurp\MailServerControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**describeMailServerDomain()**](MailServerControllerApi#describeMailServerDomain) | **POST** /mail-server/describe/domain | Get DNS Mail Server records for a domain | +| [**getDnsLookup()**](MailServerControllerApi#getDnsLookup) | **POST** /mail-server/describe/dns-lookup | Lookup DNS records for a domain | +| [**getIpAddress()**](MailServerControllerApi#getIpAddress) | **POST** /mail-server/describe/ip-address | Get IP address for a domain | +| [**verifyEmailAddress()**](MailServerControllerApi#verifyEmailAddress) | **POST** /mail-server/verify/email-address | Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. | + + +## `describeMailServerDomain()` + +```php +describeMailServerDomain($describe_domain_options): \MailSlurp\Models\DescribeMailServerDomainResult +``` + +Get DNS Mail Server records for a domain + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MailServerControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$describe_domain_options = new \MailSlurp\Models\DescribeDomainOptions(); // \MailSlurp\Models\DescribeDomainOptions + +try { + $result = $apiInstance->describeMailServerDomain($describe_domain_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MailServerControllerApi->describeMailServerDomain: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **describe_domain_options** | [**\MailSlurp\Models\DescribeDomainOptions**](../Model/DescribeDomainOptions)| | | + +### Return type + +[**\MailSlurp\Models\DescribeMailServerDomainResult**](../Model/DescribeMailServerDomainResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getDnsLookup()` + +```php +getDnsLookup($dns_lookup_options): \MailSlurp\Models\DNSLookupResults +``` + +Lookup DNS records for a domain + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MailServerControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$dns_lookup_options = new \MailSlurp\Models\DNSLookupOptions(); // \MailSlurp\Models\DNSLookupOptions + +try { + $result = $apiInstance->getDnsLookup($dns_lookup_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MailServerControllerApi->getDnsLookup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **dns_lookup_options** | [**\MailSlurp\Models\DNSLookupOptions**](../Model/DNSLookupOptions)| | | + +### Return type + +[**\MailSlurp\Models\DNSLookupResults**](../Model/DNSLookupResults) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getIpAddress()` + +```php +getIpAddress($name): \MailSlurp\Models\IPAddressResult +``` + +Get IP address for a domain + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MailServerControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$name = 'name_example'; // string + +try { + $result = $apiInstance->getIpAddress($name); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MailServerControllerApi->getIpAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **name** | **string**| | | + +### Return type + +[**\MailSlurp\Models\IPAddressResult**](../Model/IPAddressResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `verifyEmailAddress()` + +```php +verifyEmailAddress($verify_email_address_options): \MailSlurp\Models\EmailVerificationResult +``` + +Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MailServerControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$verify_email_address_options = new \MailSlurp\Models\VerifyEmailAddressOptions(); // \MailSlurp\Models\VerifyEmailAddressOptions + +try { + $result = $apiInstance->verifyEmailAddress($verify_email_address_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MailServerControllerApi->verifyEmailAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **verify_email_address_options** | [**\MailSlurp\Models\VerifyEmailAddressOptions**](../Model/VerifyEmailAddressOptions)| | | + +### Return type + +[**\MailSlurp\Models\EmailVerificationResult**](../Model/EmailVerificationResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/MissedEmailControllerApi.md b/docs/Api/MissedEmailControllerApi.md new file mode 100644 index 00000000..135b92be --- /dev/null +++ b/docs/Api/MissedEmailControllerApi.md @@ -0,0 +1,348 @@ +# MailSlurp\MissedEmailControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAllMissedEmails()**](MissedEmailControllerApi#getAllMissedEmails) | **GET** /missed-emails | Get all MissedEmails in paginated format | +| [**getAllUnknownMissedEmails()**](MissedEmailControllerApi#getAllUnknownMissedEmails) | **GET** /missed-emails/unknown | Get all unknown missed emails in paginated format | +| [**getMissedEmail()**](MissedEmailControllerApi#getMissedEmail) | **GET** /missed-emails/{missedEmailId} | Get MissedEmail | +| [**restoreMissedEmails()**](MissedEmailControllerApi#restoreMissedEmails) | **POST** /missed-emails/restore | Restore missed emails | +| [**waitForNthMissedEmail()**](MissedEmailControllerApi#waitForNthMissedEmail) | **GET** /missed-emails/waitForNthMissedEmail | Wait for Nth missed email | + + +## `getAllMissedEmails()` + +```php +getAllMissedEmails($page, $size, $sort, $search_filter, $since, $before, $inbox_id): \MailSlurp\Models\PageMissedEmailProjection +``` + +Get all MissedEmails in paginated format + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MissedEmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp +$inbox_id = 'inbox_id_example'; // string | Optional inbox ID filter + +try { + $result = $apiInstance->getAllMissedEmails($page, $size, $sort, $search_filter, $since, $before, $inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MissedEmailControllerApi->getAllMissedEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | +| **inbox_id** | **string**| Optional inbox ID filter | [optional] | + +### Return type + +[**\MailSlurp\Models\PageMissedEmailProjection**](../Model/PageMissedEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllUnknownMissedEmails()` + +```php +getAllUnknownMissedEmails($page, $size, $sort, $search_filter, $since, $before, $inbox_id): \MailSlurp\Models\PageUnknownMissedEmailProjection +``` + +Get all unknown missed emails in paginated format + +Unknown missed emails are emails that were sent to MailSlurp but could not be assigned to an existing inbox. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MissedEmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp +$inbox_id = 'inbox_id_example'; // string | Optional inbox ID filter + +try { + $result = $apiInstance->getAllUnknownMissedEmails($page, $size, $sort, $search_filter, $since, $before, $inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MissedEmailControllerApi->getAllUnknownMissedEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | +| **inbox_id** | **string**| Optional inbox ID filter | [optional] | + +### Return type + +[**\MailSlurp\Models\PageUnknownMissedEmailProjection**](../Model/PageUnknownMissedEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getMissedEmail()` + +```php +getMissedEmail($missed_email_id): \MailSlurp\Models\MissedEmailDto +``` + +Get MissedEmail + +List emails that were missed due to plan limits. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MissedEmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$missed_email_id = 'missed_email_id_example'; // string + +try { + $result = $apiInstance->getMissedEmail($missed_email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MissedEmailControllerApi->getMissedEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **missed_email_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\MissedEmailDto**](../Model/MissedEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `restoreMissedEmails()` + +```php +restoreMissedEmails() +``` + +Restore missed emails + +If emails were missed due to a plan limit they are saved as missed emails. If support team enables the canRestore flag these emails can be reload into your account using this method. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MissedEmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->restoreMissedEmails(); +} catch (Exception $e) { + echo 'Exception when calling MissedEmailControllerApi->restoreMissedEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForNthMissedEmail()` + +```php +waitForNthMissedEmail($index, $inbox_id, $timeout, $since, $before): \MailSlurp\Models\MissedEmailDto +``` + +Wait for Nth missed email + +Wait for 0 based index missed email + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\MissedEmailControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$index = 56; // int | Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 +$inbox_id = 'inbox_id_example'; // string | Optional inbox ID filter +$timeout = 56; // int | Optional timeout milliseconds +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->waitForNthMissedEmail($index, $inbox_id, $timeout, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MissedEmailControllerApi->waitForNthMissedEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **index** | **int**| Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 | | +| **inbox_id** | **string**| Optional inbox ID filter | [optional] | +| **timeout** | **int**| Optional timeout milliseconds | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\MissedEmailDto**](../Model/MissedEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/Model/AbstractWebhookPayload.md b/docs/Api/Model/AbstractWebhookPayload.md new file mode 100644 index 00000000..61394e15 --- /dev/null +++ b/docs/Api/Model/AbstractWebhookPayload.md @@ -0,0 +1,12 @@ +# # AbstractWebhookPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_name** | **string** | | +**message_id** | **string** | | +**webhook_id** | **string** | | +**webhook_name** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/AliasDto.md b/docs/Api/Model/AliasDto.md new file mode 100644 index 00000000..8f6cfc7e --- /dev/null +++ b/docs/Api/Model/AliasDto.md @@ -0,0 +1,18 @@ +# # AliasDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**email_address** | **string** | The alias's email address for receiving email | +**masked_email_address** | **string** | The underlying email address that is hidden and will received forwarded email | [optional] +**user_id** | **string** | | +**inbox_id** | **string** | Inbox that is associated with the alias | +**name** | **string** | | [optional] +**use_threads** | **bool** | If alias will generate response threads or not when email are received by it | [optional] +**is_verified** | **bool** | Has the alias been verified. You must verify an alias if the masked email address has not yet been verified by your account | +**created_at** | **\DateTime** | | [optional] +**updated_at** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/AliasProjection.md b/docs/Api/Model/AliasProjection.md new file mode 100644 index 00000000..39cea6ec --- /dev/null +++ b/docs/Api/Model/AliasProjection.md @@ -0,0 +1,16 @@ +# # AliasProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**id** | **string** | | +**inbox_id** | **string** | | +**user_id** | **string** | | +**email_address** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**use_threads** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/AttachmentEntity.md b/docs/Api/Model/AttachmentEntity.md new file mode 100644 index 00000000..9c253678 --- /dev/null +++ b/docs/Api/Model/AttachmentEntity.md @@ -0,0 +1,17 @@ +# # AttachmentEntity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**attachment_id** | **string** | | +**bucket** | **string** | | [optional] +**user_id** | **string** | | +**content_type** | **string** | | [optional] +**content_length** | **int** | | [optional] +**name** | **string** | | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/AttachmentMetaData.md b/docs/Api/Model/AttachmentMetaData.md new file mode 100644 index 00000000..d9a4fb7a --- /dev/null +++ b/docs/Api/Model/AttachmentMetaData.md @@ -0,0 +1,12 @@ +# # AttachmentMetaData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of attachment if given | +**content_type** | **string** | Content type of attachment such as `image/png` | +**content_length** | **int** | Size of attachment in bytes | +**id** | **string** | ID of attachment. Can be used to with attachment controller endpoints to download attachment or with sending methods to attach to an email. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/AttachmentProjection.md b/docs/Api/Model/AttachmentProjection.md new file mode 100644 index 00000000..8ef31806 --- /dev/null +++ b/docs/Api/Model/AttachmentProjection.md @@ -0,0 +1,15 @@ +# # AttachmentProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**content_length** | **int** | Content length of attachment in bytes | [optional] +**content_type** | **string** | Content type of attachment. | [optional] +**user_id** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**attachment_id** | **string** | Attachment ID | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BasicAuthOptions.md b/docs/Api/Model/BasicAuthOptions.md new file mode 100644 index 00000000..84205836 --- /dev/null +++ b/docs/Api/Model/BasicAuthOptions.md @@ -0,0 +1,10 @@ +# # BasicAuthOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **string** | | +**password** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BounceProjection.md b/docs/Api/Model/BounceProjection.md new file mode 100644 index 00000000..699acc9b --- /dev/null +++ b/docs/Api/Model/BounceProjection.md @@ -0,0 +1,14 @@ +# # BounceProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**sender** | **string** | | +**subject** | **string** | | [optional] +**created_at** | **\DateTime** | | +**bounce_type** | **string** | | [optional] +**bounce_mta** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BounceRecipientProjection.md b/docs/Api/Model/BounceRecipientProjection.md new file mode 100644 index 00000000..b7aa51c4 --- /dev/null +++ b/docs/Api/Model/BounceRecipientProjection.md @@ -0,0 +1,14 @@ +# # BounceRecipientProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**status** | **string** | | [optional] +**created_at** | **\DateTime** | | +**sent_email_id** | **string** | | [optional] +**recipient** | **string** | | +**action** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BouncedEmailDto.md b/docs/Api/Model/BouncedEmailDto.md new file mode 100644 index 00000000..8399012f --- /dev/null +++ b/docs/Api/Model/BouncedEmailDto.md @@ -0,0 +1,20 @@ +# # BouncedEmailDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**notification_type** | **string** | | +**sent_to_recipients** | **string[]** | | [optional] +**sender** | **string** | | +**bounce_mta** | **string** | | [optional] +**bounce_type** | **string** | | [optional] +**bounce_recipients** | **string[]** | | [optional] +**bounce_sub_type** | **string** | | [optional] +**sent_email_id** | **string** | | [optional] +**subject** | **string** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BouncedRecipientDto.md b/docs/Api/Model/BouncedRecipientDto.md new file mode 100644 index 00000000..962faaf7 --- /dev/null +++ b/docs/Api/Model/BouncedRecipientDto.md @@ -0,0 +1,16 @@ +# # BouncedRecipientDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | [optional] +**sent_email_id** | **string** | | [optional] +**recipient** | **string** | | +**diagnostic_code** | **string** | | [optional] +**action** | **string** | | [optional] +**status** | **string** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/BulkSendEmailOptions.md b/docs/Api/Model/BulkSendEmailOptions.md new file mode 100644 index 00000000..e4495dde --- /dev/null +++ b/docs/Api/Model/BulkSendEmailOptions.md @@ -0,0 +1,10 @@ +# # BulkSendEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_ids** | **string[]** | Inboxes to send the email from | +**send_email_options** | [**\MailSlurp\Models\SendEmailOptions**](SendEmailOptions) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/Complaint.md b/docs/Api/Model/Complaint.md new file mode 100644 index 00000000..a85a35d2 --- /dev/null +++ b/docs/Api/Model/Complaint.md @@ -0,0 +1,16 @@ +# # Complaint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | [optional] +**event_type** | **string** | | [optional] +**mail_source** | **string** | | [optional] +**mail_message_id** | **string** | | [optional] +**complaint_recipient** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ConditionOption.md b/docs/Api/Model/ConditionOption.md new file mode 100644 index 00000000..4553d9c9 --- /dev/null +++ b/docs/Api/Model/ConditionOption.md @@ -0,0 +1,10 @@ +# # ConditionOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**condition** | **string** | Condition of an email object that can be used to filter results | +**value** | **string** | Expected condition value | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ContactDto.md b/docs/Api/Model/ContactDto.md new file mode 100644 index 00000000..73b19025 --- /dev/null +++ b/docs/Api/Model/ContactDto.md @@ -0,0 +1,19 @@ +# # ContactDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**group_id** | **string** | | [optional] +**first_name** | **string** | | [optional] +**last_name** | **string** | | [optional] +**company** | **string** | | [optional] +**email_addresses** | **string[]** | | +**primary_email_address** | **string** | | [optional] +**tags** | **string[]** | | +**meta_data** | **object** | | [optional] +**opt_out** | **bool** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ContactProjection.md b/docs/Api/Model/ContactProjection.md new file mode 100644 index 00000000..e88cd611 --- /dev/null +++ b/docs/Api/Model/ContactProjection.md @@ -0,0 +1,16 @@ +# # ContactProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**group_id** | **string** | | [optional] +**created_at** | **\DateTime** | | +**first_name** | **string** | | [optional] +**last_name** | **string** | | [optional] +**company** | **string** | | [optional] +**email_addresses** | **string[]** | | [optional] +**opt_out** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ContentMatchOptions.md b/docs/Api/Model/ContentMatchOptions.md new file mode 100644 index 00000000..b1e8a815 --- /dev/null +++ b/docs/Api/Model/ContentMatchOptions.md @@ -0,0 +1,9 @@ +# # ContentMatchOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pattern** | **string** | Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CountDto.md b/docs/Api/Model/CountDto.md new file mode 100644 index 00000000..b851aa7f --- /dev/null +++ b/docs/Api/Model/CountDto.md @@ -0,0 +1,9 @@ +# # CountDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_elements** | **int** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateAliasOptions.md b/docs/Api/Model/CreateAliasOptions.md new file mode 100644 index 00000000..ec097c1f --- /dev/null +++ b/docs/Api/Model/CreateAliasOptions.md @@ -0,0 +1,12 @@ +# # CreateAliasOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email_address** | **string** | Email address to be hidden behind alias. Emails sent to the alias email address will be forwarded to this address. If you want to enable replies set useThreads true and the reply-to for the email will allow outbound communication via a thread. | +**inbox_id** | **string** | Optional inbox ID to attach to alias. Null by default means an a new inbox will be created for the alias. Use a custom inbox to control what email address the alias uses. To use custom email addresses create a domain and an inbox, the use the inbox ID with this call. Emails received by this inbox will be forwarded to the alias email address | [optional] +**name** | **string** | Optional name for alias | [optional] +**use_threads** | **bool** | Enable threads options. If true emails will be sent with a unique reply-to thread address. This means you can reply to the forwarded email and it will be sent to the recipients via your alias address. That way a thread conversation is preserved. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateContactOptions.md b/docs/Api/Model/CreateContactOptions.md new file mode 100644 index 00000000..911e0d40 --- /dev/null +++ b/docs/Api/Model/CreateContactOptions.md @@ -0,0 +1,16 @@ +# # CreateContactOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**first_name** | **string** | | [optional] +**last_name** | **string** | | [optional] +**company** | **string** | | [optional] +**email_addresses** | **string[]** | Set of email addresses belonging to the contact | [optional] +**tags** | **string[]** | Tags that can be used to search and group contacts | [optional] +**meta_data** | **object** | | [optional] +**opt_out** | **bool** | Has the user explicitly or implicitly opted out of being contacted? If so MailSlurp will ignore them in all actions. | [optional] +**group_id** | **string** | Group IDs that contact belongs to | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateDomainOptions.md b/docs/Api/Model/CreateDomainOptions.md new file mode 100644 index 00000000..b436ef9d --- /dev/null +++ b/docs/Api/Model/CreateDomainOptions.md @@ -0,0 +1,12 @@ +# # CreateDomainOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**domain** | **string** | The top level domain you wish to use with MailSlurp. Do not specify subdomain just the top level. So `test.com` covers all subdomains such as `mail.test.com`. Don't include a protocol such as `http://`. Once added you must complete the verification steps by adding the returned records to your domain. | +**description** | **string** | Optional description of the domain. | [optional] +**created_catch_all_inbox** | **bool** | Whether to create a catch all inbox for the domain. Any email sent to an address using your domain that cannot be matched to an existing inbox you created with the domain will be routed to the created catch all inbox. You can access emails using the regular methods on this inbox ID. | [optional] +**domain_type** | **string** | Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateEmergencyAddressOptions.md b/docs/Api/Model/CreateEmergencyAddressOptions.md new file mode 100644 index 00000000..28165e9f --- /dev/null +++ b/docs/Api/Model/CreateEmergencyAddressOptions.md @@ -0,0 +1,15 @@ +# # CreateEmergencyAddressOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer_name** | **string** | | +**address1** | **string** | | +**city** | **string** | | +**region** | **string** | | +**postal_code** | **string** | | +**iso_country_code** | **string** | | +**display_name** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateGroupOptions.md b/docs/Api/Model/CreateGroupOptions.md new file mode 100644 index 00000000..b8f866d5 --- /dev/null +++ b/docs/Api/Model/CreateGroupOptions.md @@ -0,0 +1,10 @@ +# # CreateGroupOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**description** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateInboxDto.md b/docs/Api/Model/CreateInboxDto.md new file mode 100644 index 00000000..3e843bd0 --- /dev/null +++ b/docs/Api/Model/CreateInboxDto.md @@ -0,0 +1,20 @@ +# # CreateInboxDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email_address** | **string** | A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. | [optional] +**name** | **string** | Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. | [optional] +**description** | **string** | Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with | [optional] +**use_domain_pool** | **bool** | Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. | [optional] +**tags** | **string[]** | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] +**expires_at** | **\DateTime** | Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. | [optional] +**favourite** | **bool** | Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering | [optional] +**expires_in** | **int** | Number of milliseconds that inbox should exist for | [optional] +**allow_team_access** | **bool** | DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. | [optional] +**inbox_type** | **string** | Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). | [optional] +**virtual_inbox** | **bool** | Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. | [optional] +**use_short_address** | **bool** | Use a shorter email address under 31 characters | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateInboxForwarderOptions.md b/docs/Api/Model/CreateInboxForwarderOptions.md new file mode 100644 index 00000000..fab9466a --- /dev/null +++ b/docs/Api/Model/CreateInboxForwarderOptions.md @@ -0,0 +1,11 @@ +# # CreateInboxForwarderOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field** | **string** | Field to match against to trigger inbox forwarding for inbound email | +**match** | **string** | String or wildcard style match for field specified when evaluating forwarding rules | +**forward_to_recipients** | **string[]** | Email addresses to forward an email to if it matches the field and match criteria of the forwarder | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateInboxRulesetOptions.md b/docs/Api/Model/CreateInboxRulesetOptions.md new file mode 100644 index 00000000..5688fe3b --- /dev/null +++ b/docs/Api/Model/CreateInboxRulesetOptions.md @@ -0,0 +1,11 @@ +# # CreateInboxRulesetOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scope** | **string** | What type of emails actions to apply ruleset to. Either `SENDING_EMAILS` or `RECEIVING_EMAILS` will apply action and target to any sending or receiving of emails respectively. | +**action** | **string** | Action to be taken when the ruleset matches an email for the given scope. For example: `BLOCK` action with target `*` and scope `SENDING_EMAILS` blocks sending to all recipients. Note `ALLOW` takes precedent over `BLOCK`. `FILTER_REMOVE` is like block but will remove offending email addresses during a send or receive event instead of blocking the action. | +**target** | **string** | Target to match emails with. Can be a wild-card type pattern or a valid email address. For instance `*@gmail.com` matches all gmail addresses while `test@gmail.com` matches one address exactly. The target is applied to every recipient field email address when `SENDING_EMAILS` is the scope and is applied to sender of email when `RECEIVING_EMAILS`. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateTemplateOptions.md b/docs/Api/Model/CreateTemplateOptions.md new file mode 100644 index 00000000..fe771897 --- /dev/null +++ b/docs/Api/Model/CreateTemplateOptions.md @@ -0,0 +1,10 @@ +# # CreateTemplateOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of template | +**content** | **string** | Template content. Can include moustache style variables such as {{var_name}} | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateTrackingPixelOptions.md b/docs/Api/Model/CreateTrackingPixelOptions.md new file mode 100644 index 00000000..da5e5f52 --- /dev/null +++ b/docs/Api/Model/CreateTrackingPixelOptions.md @@ -0,0 +1,10 @@ +# # CreateTrackingPixelOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**recipient** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/CreateWebhookOptions.md b/docs/Api/Model/CreateWebhookOptions.md new file mode 100644 index 00000000..703d606c --- /dev/null +++ b/docs/Api/Model/CreateWebhookOptions.md @@ -0,0 +1,14 @@ +# # CreateWebhookOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | Public URL on your server that MailSlurp can post WebhookNotification payload to when an email is received or an event is trigger. The payload of the submitted JSON is dependent on the webhook event type. See docs.mailslurp.com/webhooks for event payload documentation. | +**basic_auth** | [**\MailSlurp\Models\BasicAuthOptions**](BasicAuthOptions) | | [optional] +**name** | **string** | Optional name for the webhook | [optional] +**event_name** | **string** | Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name. | [optional] +**include_headers** | [**\MailSlurp\Models\WebhookHeaders**](WebhookHeaders) | | [optional] +**request_body_template** | **string** | Template for the JSON body of the webhook request that will be sent to your server. Use Moustache style `{{variableName}}` templating to use parts of the standard webhook payload for the given event. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DNSLookupOptions.md b/docs/Api/Model/DNSLookupOptions.md new file mode 100644 index 00000000..4010dbde --- /dev/null +++ b/docs/Api/Model/DNSLookupOptions.md @@ -0,0 +1,11 @@ +# # DNSLookupOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hostname** | **string** | List of record types you wish to query such as MX, DNS, TXT, NS, A etc. | +**record_types** | **string[]** | List of record types you wish to query such as MX, DNS, TXT, NS, A etc. | +**omit_final_dns_dot** | **bool** | Optionally control whether to omit the final dot in full DNS name values. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DNSLookupResult.md b/docs/Api/Model/DNSLookupResult.md new file mode 100644 index 00000000..c1947455 --- /dev/null +++ b/docs/Api/Model/DNSLookupResult.md @@ -0,0 +1,12 @@ +# # DNSLookupResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**record_type** | **string** | Domain Name Server Record Types | +**ttl** | **int** | | +**record_entries** | **string[]** | | +**name** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DNSLookupResults.md b/docs/Api/Model/DNSLookupResults.md new file mode 100644 index 00000000..dd232c5e --- /dev/null +++ b/docs/Api/Model/DNSLookupResults.md @@ -0,0 +1,9 @@ +# # DNSLookupResults + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**\MailSlurp\Models\DNSLookupResult[]**](DNSLookupResult) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DeliveryStatusDto.md b/docs/Api/Model/DeliveryStatusDto.md new file mode 100644 index 00000000..537ab188 --- /dev/null +++ b/docs/Api/Model/DeliveryStatusDto.md @@ -0,0 +1,22 @@ +# # DeliveryStatusDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**sent_id** | **string** | | [optional] +**remote_mta_ip** | **string** | | [optional] +**inbox_id** | **string** | | [optional] +**reporting_mta** | **string** | | [optional] +**recipients** | **string[]** | | [optional] +**smtp_response** | **string** | | [optional] +**smtp_status_code** | **int** | | [optional] +**processing_time_millis** | **int** | | [optional] +**received** | **\DateTime** | | [optional] +**subject** | **string** | | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DescribeDomainOptions.md b/docs/Api/Model/DescribeDomainOptions.md new file mode 100644 index 00000000..02c3c9a1 --- /dev/null +++ b/docs/Api/Model/DescribeDomainOptions.md @@ -0,0 +1,9 @@ +# # DescribeDomainOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**domain** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DescribeMailServerDomainResult.md b/docs/Api/Model/DescribeMailServerDomainResult.md new file mode 100644 index 00000000..be63956c --- /dev/null +++ b/docs/Api/Model/DescribeMailServerDomainResult.md @@ -0,0 +1,11 @@ +# # DescribeMailServerDomainResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mx_records** | [**\MailSlurp\Models\NameServerRecord[]**](NameServerRecord) | | +**domain** | **string** | | +**message** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DomainDto.md b/docs/Api/Model/DomainDto.md new file mode 100644 index 00000000..a5c423f6 --- /dev/null +++ b/docs/Api/Model/DomainDto.md @@ -0,0 +1,19 @@ +# # DomainDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**domain** | **string** | Custom domain name | +**verification_token** | **string** | Verification tokens | +**dkim_tokens** | **string[]** | Unique token DKIM tokens | +**is_verified** | **bool** | Whether domain has been verified or not. If the domain is not verified after 72 hours there is most likely an issue with the domains DNS records. | +**domain_name_records** | [**\MailSlurp\Models\DomainNameRecord[]**](DomainNameRecord) | List of DNS domain name records (C, MX, TXT) etc that you must add to the DNS server associated with your domain provider. | +**catch_all_inbox_id** | **string** | The optional catch all inbox that will receive emails sent to the domain that cannot be matched. | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**domain_type** | **string** | Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DomainNameRecord.md b/docs/Api/Model/DomainNameRecord.md new file mode 100644 index 00000000..2244c4c4 --- /dev/null +++ b/docs/Api/Model/DomainNameRecord.md @@ -0,0 +1,12 @@ +# # DomainNameRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**record_type** | **string** | Domain Name Server Record Types | +**name** | **string** | | +**record_entries** | **string[]** | | +**ttl** | **int** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DomainPreview.md b/docs/Api/Model/DomainPreview.md new file mode 100644 index 00000000..1bd53026 --- /dev/null +++ b/docs/Api/Model/DomainPreview.md @@ -0,0 +1,14 @@ +# # DomainPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**domain** | **string** | | +**catch_all_inbox_id** | **string** | | [optional] +**created_at** | **\DateTime** | | +**domain_type** | **string** | Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. | +**is_verified** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/DownloadAttachmentDto.md b/docs/Api/Model/DownloadAttachmentDto.md new file mode 100644 index 00000000..b6b4b292 --- /dev/null +++ b/docs/Api/Model/DownloadAttachmentDto.md @@ -0,0 +1,11 @@ +# # DownloadAttachmentDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**base64_file_contents** | **string** | Base64 encoded string of attachment bytes. Decode the base64 encoded string to get the raw contents. If the file has a content type such as `text/html` you can read the contents directly by converting it to string using `utf-8` encoding. | +**content_type** | **string** | Content type of attachment. Examples are `image/png`, `application/msword`, `text/csv` etc. | +**size_bytes** | **int** | Size in bytes of attachment content | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/Email.md b/docs/Api/Model/Email.md new file mode 100644 index 00000000..4601b144 --- /dev/null +++ b/docs/Api/Model/Email.md @@ -0,0 +1,33 @@ +# # Email + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the email entity | +**user_id** | **string** | ID of user that email belongs to | +**inbox_id** | **string** | ID of the inbox that received the email | +**domain_id** | **string** | ID of the domain that received the email | [optional] +**to** | **string[]** | List of `To` recipient email addresses that the email was addressed to. See recipients object for names. | +**from** | **string** | Who the email was sent from. An email address - see fromName for the sender name. | [optional] +**sender** | [**\MailSlurp\Models\Sender**](Sender) | | [optional] +**recipients** | [**\MailSlurp\Models\EmailRecipients**](EmailRecipients) | | [optional] +**reply_to** | **string** | The `replyTo` field on the received email message | [optional] +**cc** | **string[]** | List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. | [optional] +**bcc** | **string[]** | List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. | [optional] +**headers** | **array** | Collection of SMTP headers attached to email | [optional] +**attachments** | **string[]** | List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension. | [optional] +**subject** | **string** | The subject line of the email message as specified by SMTP subject header | [optional] +**body** | **string** | The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests. | [optional] +**body_excerpt** | **string** | An excerpt of the body of the email message for quick preview . | [optional] +**body_md5_hash** | **string** | A hash signature of the email message using MD5. Useful for comparing emails without fetching full body. | [optional] +**is_html** | **bool** | Is the email body content type HTML? | [optional] +**charset** | **string** | Detected character set of the email body such as UTF-8 | [optional] +**analysis** | [**\MailSlurp\Models\EmailAnalysis**](EmailAnalysis) | | [optional] +**created_at** | **\DateTime** | When was the email received by MailSlurp | +**updated_at** | **\DateTime** | When was the email last updated | +**read** | **bool** | Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. | +**team_access** | **bool** | Can the email be accessed by organization team members | +**html** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailAnalysis.md b/docs/Api/Model/EmailAnalysis.md new file mode 100644 index 00000000..08627142 --- /dev/null +++ b/docs/Api/Model/EmailAnalysis.md @@ -0,0 +1,13 @@ +# # EmailAnalysis + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**spam_verdict** | **string** | Verdict of spam ranking analysis | [optional] +**virus_verdict** | **string** | Verdict of virus scan analysis | [optional] +**spf_verdict** | **string** | Verdict of Send Policy Framework record spoofing analysis | [optional] +**dkim_verdict** | **string** | Verdict of DomainKeys Identified Mail analysis | [optional] +**dmarc_verdict** | **string** | Verdict of Domain-based Message Authentication Reporting and Conformance analysis | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailContentMatchResult.md b/docs/Api/Model/EmailContentMatchResult.md new file mode 100644 index 00000000..2672e9cc --- /dev/null +++ b/docs/Api/Model/EmailContentMatchResult.md @@ -0,0 +1,10 @@ +# # EmailContentMatchResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pattern** | **string** | | +**matches** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailHtmlDto.md b/docs/Api/Model/EmailHtmlDto.md new file mode 100644 index 00000000..ab8cf4b0 --- /dev/null +++ b/docs/Api/Model/EmailHtmlDto.md @@ -0,0 +1,10 @@ +# # EmailHtmlDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**subject** | **string** | | [optional] +**body** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailLinksResult.md b/docs/Api/Model/EmailLinksResult.md new file mode 100644 index 00000000..a8664c57 --- /dev/null +++ b/docs/Api/Model/EmailLinksResult.md @@ -0,0 +1,10 @@ +# # EmailLinksResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | **string[]** | | +**body** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailPreview.md b/docs/Api/Model/EmailPreview.md new file mode 100644 index 00000000..3095e6bf --- /dev/null +++ b/docs/Api/Model/EmailPreview.md @@ -0,0 +1,18 @@ +# # EmailPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the email entity | +**domain_id** | **string** | ID of the domain that received the email | [optional] +**subject** | **string** | The subject line of the email message as specified by SMTP subject header | [optional] +**to** | **string[]** | List of `To` recipient email addresses that the email was addressed to. See recipients object for names. | +**from** | **string** | Who the email was sent from. An email address - see fromName for the sender name. | [optional] +**bcc** | **string[]** | List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. | [optional] +**cc** | **string[]** | List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. | [optional] +**created_at** | **\DateTime** | When was the email received by MailSlurp | +**read** | **bool** | Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. | +**attachments** | **string[]** | List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailPreviewUrls.md b/docs/Api/Model/EmailPreviewUrls.md new file mode 100644 index 00000000..f4a199f2 --- /dev/null +++ b/docs/Api/Model/EmailPreviewUrls.md @@ -0,0 +1,10 @@ +# # EmailPreviewUrls + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**raw_smtp_message_url** | **string** | | +**plain_html_body_url** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailProjection.md b/docs/Api/Model/EmailProjection.md new file mode 100644 index 00000000..3cdac044 --- /dev/null +++ b/docs/Api/Model/EmailProjection.md @@ -0,0 +1,22 @@ +# # EmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**from** | **string** | | [optional] +**subject** | **string** | | [optional] +**inbox_id** | **string** | | +**created_at** | **\DateTime** | | +**attachments** | **string[]** | | [optional] +**to** | **string[]** | | +**bcc** | **string[]** | | [optional] +**cc** | **string[]** | | [optional] +**domain_id** | **string** | | [optional] +**body_md5_hash** | **string** | | [optional] +**read** | **bool** | | +**body_excerpt** | **string** | | [optional] +**team_access** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailRecipients.md b/docs/Api/Model/EmailRecipients.md new file mode 100644 index 00000000..c230f964 --- /dev/null +++ b/docs/Api/Model/EmailRecipients.md @@ -0,0 +1,11 @@ +# # EmailRecipients + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | [**\MailSlurp\Models\Recipient[]**](Recipient) | | [optional] +**cc** | [**\MailSlurp\Models\Recipient[]**](Recipient) | | [optional] +**bcc** | [**\MailSlurp\Models\Recipient[]**](Recipient) | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailTextLinesResult.md b/docs/Api/Model/EmailTextLinesResult.md new file mode 100644 index 00000000..b92634c9 --- /dev/null +++ b/docs/Api/Model/EmailTextLinesResult.md @@ -0,0 +1,10 @@ +# # EmailTextLinesResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lines** | **string[]** | | +**body** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailValidationRequestDto.md b/docs/Api/Model/EmailValidationRequestDto.md new file mode 100644 index 00000000..c117793b --- /dev/null +++ b/docs/Api/Model/EmailValidationRequestDto.md @@ -0,0 +1,14 @@ +# # EmailValidationRequestDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**email_address** | **string** | | +**is_valid** | **bool** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmailVerificationResult.md b/docs/Api/Model/EmailVerificationResult.md new file mode 100644 index 00000000..9bdeacc4 --- /dev/null +++ b/docs/Api/Model/EmailVerificationResult.md @@ -0,0 +1,13 @@ +# # EmailVerificationResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**domain_name** | **string** | | +**port** | **int** | | +**email_address** | **string** | | +**is_valid** | **bool** | | +**error** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmergencyAddress.md b/docs/Api/Model/EmergencyAddress.md new file mode 100644 index 00000000..be3e0c8c --- /dev/null +++ b/docs/Api/Model/EmergencyAddress.md @@ -0,0 +1,21 @@ +# # EmergencyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**sid** | **string** | | +**user_id** | **string** | | +**display_name** | **string** | | +**customer_name** | **string** | | +**address1** | **string** | | +**city** | **string** | | +**region** | **string** | | +**postal_code** | **string** | | +**phone_country** | **string** | | +**account_sid** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmergencyAddressDto.md b/docs/Api/Model/EmergencyAddressDto.md new file mode 100644 index 00000000..7dd81b1b --- /dev/null +++ b/docs/Api/Model/EmergencyAddressDto.md @@ -0,0 +1,11 @@ +# # EmergencyAddressDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**address1** | **string** | | +**phone_country** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/EmptyResponseDto.md b/docs/Api/Model/EmptyResponseDto.md new file mode 100644 index 00000000..6f239266 --- /dev/null +++ b/docs/Api/Model/EmptyResponseDto.md @@ -0,0 +1,9 @@ +# # EmptyResponseDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ExpirationDefaults.md b/docs/Api/Model/ExpirationDefaults.md new file mode 100644 index 00000000..28424422 --- /dev/null +++ b/docs/Api/Model/ExpirationDefaults.md @@ -0,0 +1,13 @@ +# # ExpirationDefaults + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**default_expiration_millis** | **int** | | [optional] +**max_expiration_millis** | **int** | | [optional] +**default_expires_at** | **\DateTime** | | [optional] +**can_permanent_inbox** | **bool** | | +**next_inbox_allows_permanent** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ExpiredInboxDto.md b/docs/Api/Model/ExpiredInboxDto.md new file mode 100644 index 00000000..6472f273 --- /dev/null +++ b/docs/Api/Model/ExpiredInboxDto.md @@ -0,0 +1,11 @@ +# # ExpiredInboxDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**inbox_id** | **string** | | +**email_address** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ExpiredInboxRecordProjection.md b/docs/Api/Model/ExpiredInboxRecordProjection.md new file mode 100644 index 00000000..026494a4 --- /dev/null +++ b/docs/Api/Model/ExpiredInboxRecordProjection.md @@ -0,0 +1,12 @@ +# # ExpiredInboxRecordProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**email_address** | **string** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ExportLink.md b/docs/Api/Model/ExportLink.md new file mode 100644 index 00000000..37cbd25a --- /dev/null +++ b/docs/Api/Model/ExportLink.md @@ -0,0 +1,9 @@ +# # ExportLink + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**download_link** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ExportOptions.md b/docs/Api/Model/ExportOptions.md new file mode 100644 index 00000000..c3fb2723 --- /dev/null +++ b/docs/Api/Model/ExportOptions.md @@ -0,0 +1,14 @@ +# # ExportOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**output_format** | **string** | | +**exclude_previously_exported** | **bool** | | [optional] +**created_earliest_time** | **\DateTime** | | [optional] +**created_oldest_time** | **\DateTime** | | [optional] +**filter** | **string** | | [optional] +**list_separator_token** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/FilterBouncedRecipientsOptions.md b/docs/Api/Model/FilterBouncedRecipientsOptions.md new file mode 100644 index 00000000..3bf18ee2 --- /dev/null +++ b/docs/Api/Model/FilterBouncedRecipientsOptions.md @@ -0,0 +1,9 @@ +# # FilterBouncedRecipientsOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email_recipients** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/FilterBouncedRecipientsResult.md b/docs/Api/Model/FilterBouncedRecipientsResult.md new file mode 100644 index 00000000..adad0e5f --- /dev/null +++ b/docs/Api/Model/FilterBouncedRecipientsResult.md @@ -0,0 +1,9 @@ +# # FilterBouncedRecipientsResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**filtered_recipients** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/FlushExpiredInboxesResult.md b/docs/Api/Model/FlushExpiredInboxesResult.md new file mode 100644 index 00000000..a6724297 --- /dev/null +++ b/docs/Api/Model/FlushExpiredInboxesResult.md @@ -0,0 +1,10 @@ +# # FlushExpiredInboxesResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_ids** | **string[]** | Inbox IDs affected by expiration | +**expire_before** | **\DateTime** | DateTime to filter inboxes so that those expiring before this time are expired | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ForwardEmailOptions.md b/docs/Api/Model/ForwardEmailOptions.md new file mode 100644 index 00000000..ed82845e --- /dev/null +++ b/docs/Api/Model/ForwardEmailOptions.md @@ -0,0 +1,15 @@ +# # ForwardEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | **string[]** | To recipients for forwarded email | +**subject** | **string** | Subject for forwarded email | [optional] +**cc** | **string[]** | Optional cc recipients | [optional] +**bcc** | **string[]** | Optional bcc recipients | [optional] +**from** | **string** | Optional from override | [optional] +**use_inbox_name** | **bool** | Optionally use inbox name as display name for sender email address | [optional] +**filter_bounced_recipients** | **bool** | Filter recipients to remove any bounced recipients from to, bcc, and cc before sending | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/GravatarUrl.md b/docs/Api/Model/GravatarUrl.md new file mode 100644 index 00000000..0893a93b --- /dev/null +++ b/docs/Api/Model/GravatarUrl.md @@ -0,0 +1,10 @@ +# # GravatarUrl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | | +**hash** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/GroupContactsDto.md b/docs/Api/Model/GroupContactsDto.md new file mode 100644 index 00000000..76d37d32 --- /dev/null +++ b/docs/Api/Model/GroupContactsDto.md @@ -0,0 +1,10 @@ +# # GroupContactsDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**group** | [**\MailSlurp\Models\GroupDto**](GroupDto) | | +**contacts** | [**\MailSlurp\Models\ContactDto[]**](ContactDto) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/GroupDto.md b/docs/Api/Model/GroupDto.md new file mode 100644 index 00000000..c71fe146 --- /dev/null +++ b/docs/Api/Model/GroupDto.md @@ -0,0 +1,12 @@ +# # GroupDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**name** | **string** | | +**description** | **string** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/GroupProjection.md b/docs/Api/Model/GroupProjection.md new file mode 100644 index 00000000..bea85eb8 --- /dev/null +++ b/docs/Api/Model/GroupProjection.md @@ -0,0 +1,12 @@ +# # GroupProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**id** | **string** | | +**description** | **string** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/HTMLValidationResult.md b/docs/Api/Model/HTMLValidationResult.md new file mode 100644 index 00000000..b9012d8a --- /dev/null +++ b/docs/Api/Model/HTMLValidationResult.md @@ -0,0 +1,11 @@ +# # HTMLValidationResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is_valid** | **bool** | Is HTML validation result valid | +**errors** | [**\MailSlurp\Models\ValidationMessage[]**](ValidationMessage) | Optional errors resulting from HTML validation | +**warnings** | [**\MailSlurp\Models\ValidationMessage[]**](ValidationMessage) | Optional warnings resulting from HTML validation | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/IPAddressResult.md b/docs/Api/Model/IPAddressResult.md new file mode 100644 index 00000000..d87ec8bd --- /dev/null +++ b/docs/Api/Model/IPAddressResult.md @@ -0,0 +1,10 @@ +# # IPAddressResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **string** | | +**hostname** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ImapFlagOperationOptions.md b/docs/Api/Model/ImapFlagOperationOptions.md new file mode 100644 index 00000000..31df225a --- /dev/null +++ b/docs/Api/Model/ImapFlagOperationOptions.md @@ -0,0 +1,10 @@ +# # ImapFlagOperationOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**flag_operation** | **string** | | +**flags** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ImapSmtpAccessDetails.md b/docs/Api/Model/ImapSmtpAccessDetails.md new file mode 100644 index 00000000..c1fb37b5 --- /dev/null +++ b/docs/Api/Model/ImapSmtpAccessDetails.md @@ -0,0 +1,16 @@ +# # ImapSmtpAccessDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smtp_server_host** | **string** | SMTP server host domain | +**smtp_server_port** | **int** | SMTP server host port | +**smtp_username** | **string** | SMTP username for login | +**smtp_password** | **string** | SMTP for login | +**imap_server_host** | **string** | IMAP server host domain | +**imap_server_port** | **int** | IMAP server host port | +**imap_username** | **string** | IMAP username for login | +**imap_password** | **string** | IMAP password for login | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxByEmailAddressResult.md b/docs/Api/Model/InboxByEmailAddressResult.md new file mode 100644 index 00000000..32915ddf --- /dev/null +++ b/docs/Api/Model/InboxByEmailAddressResult.md @@ -0,0 +1,10 @@ +# # InboxByEmailAddressResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_id** | **string** | | [optional] +**exists** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxByNameResult.md b/docs/Api/Model/InboxByNameResult.md new file mode 100644 index 00000000..1429dda4 --- /dev/null +++ b/docs/Api/Model/InboxByNameResult.md @@ -0,0 +1,10 @@ +# # InboxByNameResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_id** | **string** | | [optional] +**exists** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxDto.md b/docs/Api/Model/InboxDto.md new file mode 100644 index 00000000..b0349e0c --- /dev/null +++ b/docs/Api/Model/InboxDto.md @@ -0,0 +1,21 @@ +# # InboxDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. | +**user_id** | **string** | ID of user that inbox belongs to | [optional] +**created_at** | **\DateTime** | When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. | +**name** | **string** | Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search | [optional] +**domain_id** | **string** | ID of custom domain used by the inbox if any | [optional] +**description** | **string** | Description of an inbox for labelling and searching purposes | [optional] +**email_address** | **string** | The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. | +**expires_at** | **string** | Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. | [optional] +**favourite** | **bool** | Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering | +**tags** | **string[]** | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] +**inbox_type** | **string** | Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). | [optional] +**read_only** | **bool** | Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes. | +**virtual_inbox** | **bool** | Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxExistsDto.md b/docs/Api/Model/InboxExistsDto.md new file mode 100644 index 00000000..5edbc5dc --- /dev/null +++ b/docs/Api/Model/InboxExistsDto.md @@ -0,0 +1,9 @@ +# # InboxExistsDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exists** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxForwarderDto.md b/docs/Api/Model/InboxForwarderDto.md new file mode 100644 index 00000000..29c448b8 --- /dev/null +++ b/docs/Api/Model/InboxForwarderDto.md @@ -0,0 +1,14 @@ +# # InboxForwarderDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**inbox_id** | **string** | | +**field** | **string** | | +**match** | **string** | | +**forward_to_recipients** | **string[]** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxForwarderEventProjection.md b/docs/Api/Model/InboxForwarderEventProjection.md new file mode 100644 index 00000000..5f908974 --- /dev/null +++ b/docs/Api/Model/InboxForwarderEventProjection.md @@ -0,0 +1,16 @@ +# # InboxForwarderEventProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | [optional] +**id** | **string** | | [optional] +**status** | **string** | | [optional] +**email_id** | **string** | | [optional] +**inbox_id** | **string** | | [optional] +**user_id** | **string** | | [optional] +**created_at** | **\DateTime** | | +**forwarder_id** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxForwarderTestOptions.md b/docs/Api/Model/InboxForwarderTestOptions.md new file mode 100644 index 00000000..59cdb36b --- /dev/null +++ b/docs/Api/Model/InboxForwarderTestOptions.md @@ -0,0 +1,9 @@ +# # InboxForwarderTestOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**test_value** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxForwarderTestResult.md b/docs/Api/Model/InboxForwarderTestResult.md new file mode 100644 index 00000000..87076650 --- /dev/null +++ b/docs/Api/Model/InboxForwarderTestResult.md @@ -0,0 +1,10 @@ +# # InboxForwarderTestResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**matches** | **array** | | +**does_match** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxIdItem.md b/docs/Api/Model/InboxIdItem.md new file mode 100644 index 00000000..2dd19dd8 --- /dev/null +++ b/docs/Api/Model/InboxIdItem.md @@ -0,0 +1,10 @@ +# # InboxIdItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**email_address** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxIdsResult.md b/docs/Api/Model/InboxIdsResult.md new file mode 100644 index 00000000..43078bb1 --- /dev/null +++ b/docs/Api/Model/InboxIdsResult.md @@ -0,0 +1,9 @@ +# # InboxIdsResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_ids** | [**\MailSlurp\Models\InboxIdItem[]**](InboxIdItem) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxPreview.md b/docs/Api/Model/InboxPreview.md new file mode 100644 index 00000000..d659203f --- /dev/null +++ b/docs/Api/Model/InboxPreview.md @@ -0,0 +1,19 @@ +# # InboxPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. | +**domain_id** | **string** | ID of custom domain used by the inbox if any | [optional] +**email_address** | **string** | The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. | [optional] +**created_at** | **\DateTime** | When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. | +**favourite** | **bool** | Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering | +**name** | **string** | Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search | [optional] +**tags** | **string[]** | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] +**team_access** | **bool** | Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/ | +**inbox_type** | **string** | Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). | [optional] +**virtual_inbox** | **bool** | Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. | +**expires_at** | **string** | Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxRulesetDto.md b/docs/Api/Model/InboxRulesetDto.md new file mode 100644 index 00000000..2fd8525e --- /dev/null +++ b/docs/Api/Model/InboxRulesetDto.md @@ -0,0 +1,15 @@ +# # InboxRulesetDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**inbox_id** | **string** | | +**scope** | **string** | | +**action** | **string** | | +**target** | **string** | | +**handler** | **string** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxRulesetTestOptions.md b/docs/Api/Model/InboxRulesetTestOptions.md new file mode 100644 index 00000000..ffa3c421 --- /dev/null +++ b/docs/Api/Model/InboxRulesetTestOptions.md @@ -0,0 +1,9 @@ +# # InboxRulesetTestOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**test_target** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/InboxRulesetTestResult.md b/docs/Api/Model/InboxRulesetTestResult.md new file mode 100644 index 00000000..1e525b69 --- /dev/null +++ b/docs/Api/Model/InboxRulesetTestResult.md @@ -0,0 +1,10 @@ +# # InboxRulesetTestResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ruleset_matches** | **array** | Map of inbox ruleset ID to boolean of if target matches | +**matches** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/JSONSchemaDto.md b/docs/Api/Model/JSONSchemaDto.md new file mode 100644 index 00000000..a2e46abd --- /dev/null +++ b/docs/Api/Model/JSONSchemaDto.md @@ -0,0 +1,9 @@ +# # JSONSchemaDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ListUnsubscribeRecipientProjection.md b/docs/Api/Model/ListUnsubscribeRecipientProjection.md new file mode 100644 index 00000000..e1aa58fd --- /dev/null +++ b/docs/Api/Model/ListUnsubscribeRecipientProjection.md @@ -0,0 +1,12 @@ +# # ListUnsubscribeRecipientProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**email_address** | **string** | | +**created_at** | **\DateTime** | | +**domain_id** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/MatchOption.md b/docs/Api/Model/MatchOption.md new file mode 100644 index 00000000..04341746 --- /dev/null +++ b/docs/Api/Model/MatchOption.md @@ -0,0 +1,11 @@ +# # MatchOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field** | **string** | Fields of an email object that can be used to filter results | +**should** | **string** | How the value of the email field specified should be compared to the value given in the match options. | +**value** | **string** | The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/MatchOptions.md b/docs/Api/Model/MatchOptions.md new file mode 100644 index 00000000..db12ffc0 --- /dev/null +++ b/docs/Api/Model/MatchOptions.md @@ -0,0 +1,10 @@ +# # MatchOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**matches** | [**\MailSlurp\Models\MatchOption[]**](MatchOption) | Zero or more match options such as `{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }`. Options are additive so if one does not match the email is excluded from results | [optional] +**conditions** | [**\MailSlurp\Models\ConditionOption[]**](ConditionOption) | Zero or more conditions such as `{ condition: 'HAS_ATTACHMENTS', value: 'TRUE' }`. Note the values are the strings `TRUE|FALSE` not booleans. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/MissedEmailDto.md b/docs/Api/Model/MissedEmailDto.md new file mode 100644 index 00000000..23748d86 --- /dev/null +++ b/docs/Api/Model/MissedEmailDto.md @@ -0,0 +1,24 @@ +# # MissedEmailDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | [optional] +**subject** | **string** | | [optional] +**body_excerpt** | **string** | | [optional] +**attachment_count** | **int** | | +**from** | **string** | | [optional] +**raw_url** | **string** | | [optional] +**raw_key** | **string** | | [optional] +**raw_bucket** | **string** | | [optional] +**can_restore** | **bool** | | [optional] +**to** | **string[]** | | +**cc** | **string[]** | | +**bcc** | **string[]** | | +**inbox_ids** | **string[]** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/MissedEmailProjection.md b/docs/Api/Model/MissedEmailProjection.md new file mode 100644 index 00000000..d9356af1 --- /dev/null +++ b/docs/Api/Model/MissedEmailProjection.md @@ -0,0 +1,13 @@ +# # MissedEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**from** | **string** | | [optional] +**subject** | **string** | | [optional] +**user_id** | **string** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/NameServerRecord.md b/docs/Api/Model/NameServerRecord.md new file mode 100644 index 00000000..2d4a66af --- /dev/null +++ b/docs/Api/Model/NameServerRecord.md @@ -0,0 +1,12 @@ +# # NameServerRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**raw** | **string** | | +**record_type** | **string** | | +**priority** | **string** | | +**value** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/OrganizationInboxProjection.md b/docs/Api/Model/OrganizationInboxProjection.md new file mode 100644 index 00000000..0ee57924 --- /dev/null +++ b/docs/Api/Model/OrganizationInboxProjection.md @@ -0,0 +1,19 @@ +# # OrganizationInboxProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. | +**domain_id** | **string** | ID of custom domain used by the inbox if any | [optional] +**created_at** | **\DateTime** | When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. | +**name** | **string** | Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search | [optional] +**email_address** | **string** | The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. | [optional] +**favourite** | **bool** | Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering | +**tags** | **string[]** | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] +**team_access** | **bool** | Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/ | +**inbox_type** | **string** | Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). | [optional] +**read_only** | **bool** | Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes. | +**virtual_inbox** | **bool** | Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageAlias.md b/docs/Api/Model/PageAlias.md new file mode 100644 index 00000000..300b45dd --- /dev/null +++ b/docs/Api/Model/PageAlias.md @@ -0,0 +1,20 @@ +# # PageAlias + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\AliasProjection[]**](AliasProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageAttachmentEntity.md b/docs/Api/Model/PageAttachmentEntity.md new file mode 100644 index 00000000..686e5662 --- /dev/null +++ b/docs/Api/Model/PageAttachmentEntity.md @@ -0,0 +1,20 @@ +# # PageAttachmentEntity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\AttachmentProjection[]**](AttachmentProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageBouncedEmail.md b/docs/Api/Model/PageBouncedEmail.md new file mode 100644 index 00000000..59dd8e32 --- /dev/null +++ b/docs/Api/Model/PageBouncedEmail.md @@ -0,0 +1,20 @@ +# # PageBouncedEmail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\BounceProjection[]**](BounceProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageBouncedRecipients.md b/docs/Api/Model/PageBouncedRecipients.md new file mode 100644 index 00000000..25cb012f --- /dev/null +++ b/docs/Api/Model/PageBouncedRecipients.md @@ -0,0 +1,20 @@ +# # PageBouncedRecipients + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\BounceRecipientProjection[]**](BounceRecipientProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageComplaint.md b/docs/Api/Model/PageComplaint.md new file mode 100644 index 00000000..488053d2 --- /dev/null +++ b/docs/Api/Model/PageComplaint.md @@ -0,0 +1,20 @@ +# # PageComplaint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\Complaint[]**](Complaint) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageContactProjection.md b/docs/Api/Model/PageContactProjection.md new file mode 100644 index 00000000..2e6932a4 --- /dev/null +++ b/docs/Api/Model/PageContactProjection.md @@ -0,0 +1,20 @@ +# # PageContactProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\ContactProjection[]**](ContactProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageDeliveryStatus.md b/docs/Api/Model/PageDeliveryStatus.md new file mode 100644 index 00000000..63552a83 --- /dev/null +++ b/docs/Api/Model/PageDeliveryStatus.md @@ -0,0 +1,20 @@ +# # PageDeliveryStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\DeliveryStatusDto[]**](DeliveryStatusDto) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageEmailPreview.md b/docs/Api/Model/PageEmailPreview.md new file mode 100644 index 00000000..a36ad454 --- /dev/null +++ b/docs/Api/Model/PageEmailPreview.md @@ -0,0 +1,20 @@ +# # PageEmailPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\EmailPreview[]**](EmailPreview) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageEmailProjection.md b/docs/Api/Model/PageEmailProjection.md new file mode 100644 index 00000000..55212867 --- /dev/null +++ b/docs/Api/Model/PageEmailProjection.md @@ -0,0 +1,20 @@ +# # PageEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\EmailProjection[]**](EmailProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageEmailValidationRequest.md b/docs/Api/Model/PageEmailValidationRequest.md new file mode 100644 index 00000000..e535750e --- /dev/null +++ b/docs/Api/Model/PageEmailValidationRequest.md @@ -0,0 +1,20 @@ +# # PageEmailValidationRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\EmailValidationRequestDto[]**](EmailValidationRequestDto) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageExpiredInboxRecordProjection.md b/docs/Api/Model/PageExpiredInboxRecordProjection.md new file mode 100644 index 00000000..9ce9da59 --- /dev/null +++ b/docs/Api/Model/PageExpiredInboxRecordProjection.md @@ -0,0 +1,20 @@ +# # PageExpiredInboxRecordProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\ExpiredInboxRecordProjection[]**](ExpiredInboxRecordProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageGroupProjection.md b/docs/Api/Model/PageGroupProjection.md new file mode 100644 index 00000000..d4a5f6c1 --- /dev/null +++ b/docs/Api/Model/PageGroupProjection.md @@ -0,0 +1,20 @@ +# # PageGroupProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\GroupProjection[]**](GroupProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageInboxForwarderDto.md b/docs/Api/Model/PageInboxForwarderDto.md new file mode 100644 index 00000000..ed13d80e --- /dev/null +++ b/docs/Api/Model/PageInboxForwarderDto.md @@ -0,0 +1,20 @@ +# # PageInboxForwarderDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\InboxForwarderDto[]**](InboxForwarderDto) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageInboxForwarderEvents.md b/docs/Api/Model/PageInboxForwarderEvents.md new file mode 100644 index 00000000..dbac29dc --- /dev/null +++ b/docs/Api/Model/PageInboxForwarderEvents.md @@ -0,0 +1,20 @@ +# # PageInboxForwarderEvents + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\InboxForwarderEventProjection[]**](InboxForwarderEventProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageInboxProjection.md b/docs/Api/Model/PageInboxProjection.md new file mode 100644 index 00000000..08e207b0 --- /dev/null +++ b/docs/Api/Model/PageInboxProjection.md @@ -0,0 +1,20 @@ +# # PageInboxProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\InboxPreview[]**](InboxPreview) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageInboxRulesetDto.md b/docs/Api/Model/PageInboxRulesetDto.md new file mode 100644 index 00000000..6a47cf0d --- /dev/null +++ b/docs/Api/Model/PageInboxRulesetDto.md @@ -0,0 +1,20 @@ +# # PageInboxRulesetDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\InboxRulesetDto[]**](InboxRulesetDto) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageListUnsubscribeRecipients.md b/docs/Api/Model/PageListUnsubscribeRecipients.md new file mode 100644 index 00000000..d7f350ca --- /dev/null +++ b/docs/Api/Model/PageListUnsubscribeRecipients.md @@ -0,0 +1,20 @@ +# # PageListUnsubscribeRecipients + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\ListUnsubscribeRecipientProjection[]**](ListUnsubscribeRecipientProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageMissedEmailProjection.md b/docs/Api/Model/PageMissedEmailProjection.md new file mode 100644 index 00000000..431e0799 --- /dev/null +++ b/docs/Api/Model/PageMissedEmailProjection.md @@ -0,0 +1,20 @@ +# # PageMissedEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\MissedEmailProjection[]**](MissedEmailProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageOrganizationInboxProjection.md b/docs/Api/Model/PageOrganizationInboxProjection.md new file mode 100644 index 00000000..f9d995f0 --- /dev/null +++ b/docs/Api/Model/PageOrganizationInboxProjection.md @@ -0,0 +1,20 @@ +# # PageOrganizationInboxProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\OrganizationInboxProjection[]**](OrganizationInboxProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PagePhoneNumberProjection.md b/docs/Api/Model/PagePhoneNumberProjection.md new file mode 100644 index 00000000..4268e8bd --- /dev/null +++ b/docs/Api/Model/PagePhoneNumberProjection.md @@ -0,0 +1,20 @@ +# # PagePhoneNumberProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\PhoneNumberProjection[]**](PhoneNumberProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageScheduledJobs.md b/docs/Api/Model/PageScheduledJobs.md new file mode 100644 index 00000000..246ace1a --- /dev/null +++ b/docs/Api/Model/PageScheduledJobs.md @@ -0,0 +1,20 @@ +# # PageScheduledJobs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\ScheduledJob[]**](ScheduledJob) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageSentEmailProjection.md b/docs/Api/Model/PageSentEmailProjection.md new file mode 100644 index 00000000..c866f972 --- /dev/null +++ b/docs/Api/Model/PageSentEmailProjection.md @@ -0,0 +1,20 @@ +# # PageSentEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\SentEmailProjection[]**](SentEmailProjection) | Collection of items | +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**size** | **int** | Size of page requested | +**number** | **int** | Page number starting at 0 | +**number_of_elements** | **int** | Number of items returned | +**total_elements** | **int** | Total number of items available for querying | +**total_pages** | **int** | Total number of pages available | +**last** | **bool** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageSentEmailWithQueueProjection.md b/docs/Api/Model/PageSentEmailWithQueueProjection.md new file mode 100644 index 00000000..9562e9a1 --- /dev/null +++ b/docs/Api/Model/PageSentEmailWithQueueProjection.md @@ -0,0 +1,20 @@ +# # PageSentEmailWithQueueProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\SendWithQueueResult[]**](SendWithQueueResult) | Collection of items | +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**size** | **int** | Size of page requested | +**number** | **int** | Page number starting at 0 | +**number_of_elements** | **int** | Number of items returned | +**total_elements** | **int** | Total number of items available for querying | +**total_pages** | **int** | Total number of pages available | +**last** | **bool** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageSmsProjection.md b/docs/Api/Model/PageSmsProjection.md new file mode 100644 index 00000000..71692002 --- /dev/null +++ b/docs/Api/Model/PageSmsProjection.md @@ -0,0 +1,20 @@ +# # PageSmsProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\SmsProjection[]**](SmsProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageTemplateProjection.md b/docs/Api/Model/PageTemplateProjection.md new file mode 100644 index 00000000..98303d7a --- /dev/null +++ b/docs/Api/Model/PageTemplateProjection.md @@ -0,0 +1,20 @@ +# # PageTemplateProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\TemplateProjection[]**](TemplateProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageThreadProjection.md b/docs/Api/Model/PageThreadProjection.md new file mode 100644 index 00000000..95acecab --- /dev/null +++ b/docs/Api/Model/PageThreadProjection.md @@ -0,0 +1,20 @@ +# # PageThreadProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\ThreadProjection[]**](ThreadProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageTrackingPixelProjection.md b/docs/Api/Model/PageTrackingPixelProjection.md new file mode 100644 index 00000000..baec64f7 --- /dev/null +++ b/docs/Api/Model/PageTrackingPixelProjection.md @@ -0,0 +1,20 @@ +# # PageTrackingPixelProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\TrackingPixelProjection[]**](TrackingPixelProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageUnknownMissedEmailProjection.md b/docs/Api/Model/PageUnknownMissedEmailProjection.md new file mode 100644 index 00000000..0b15c025 --- /dev/null +++ b/docs/Api/Model/PageUnknownMissedEmailProjection.md @@ -0,0 +1,20 @@ +# # PageUnknownMissedEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\UnknownMissedEmailProjection[]**](UnknownMissedEmailProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageWebhookProjection.md b/docs/Api/Model/PageWebhookProjection.md new file mode 100644 index 00000000..7613733d --- /dev/null +++ b/docs/Api/Model/PageWebhookProjection.md @@ -0,0 +1,20 @@ +# # PageWebhookProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\WebhookProjection[]**](WebhookProjection) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageWebhookResult.md b/docs/Api/Model/PageWebhookResult.md new file mode 100644 index 00000000..802db652 --- /dev/null +++ b/docs/Api/Model/PageWebhookResult.md @@ -0,0 +1,20 @@ +# # PageWebhookResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | [**\MailSlurp\Models\WebhookResultDto[]**](WebhookResultDto) | | [optional] +**pageable** | [**\MailSlurp\Models\PageableObject**](PageableObject) | | [optional] +**total** | **int** | | [optional] +**last** | **bool** | | [optional] +**total_elements** | **int** | | [optional] +**total_pages** | **int** | | [optional] +**size** | **int** | | [optional] +**number** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**first** | **bool** | | [optional] +**number_of_elements** | **int** | | [optional] +**empty** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PageableObject.md b/docs/Api/Model/PageableObject.md new file mode 100644 index 00000000..83f924d8 --- /dev/null +++ b/docs/Api/Model/PageableObject.md @@ -0,0 +1,14 @@ +# # PageableObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**offset** | **int** | | [optional] +**sort** | [**\MailSlurp\Models\Sort**](Sort) | | [optional] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**paged** | **bool** | | [optional] +**unpaged** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PhoneNumberDto.md b/docs/Api/Model/PhoneNumberDto.md new file mode 100644 index 00000000..570683ac --- /dev/null +++ b/docs/Api/Model/PhoneNumberDto.md @@ -0,0 +1,17 @@ +# # PhoneNumberDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**compliance_address** | **string** | | [optional] +**emergency_address** | **string** | | [optional] +**phone_number** | **string** | | +**phone_country** | **string** | | +**phone_plan** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PhoneNumberProjection.md b/docs/Api/Model/PhoneNumberProjection.md new file mode 100644 index 00000000..0dd596f5 --- /dev/null +++ b/docs/Api/Model/PhoneNumberProjection.md @@ -0,0 +1,13 @@ +# # PhoneNumberProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**created_at** | **\DateTime** | | +**phone_number** | **string** | | +**phone_country** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/PhonePlanDto.md b/docs/Api/Model/PhonePlanDto.md new file mode 100644 index 00000000..3fbcaa98 --- /dev/null +++ b/docs/Api/Model/PhonePlanDto.md @@ -0,0 +1,12 @@ +# # PhonePlanDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**phone_country** | **string** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/RawEmailJson.md b/docs/Api/Model/RawEmailJson.md new file mode 100644 index 00000000..cea59eb9 --- /dev/null +++ b/docs/Api/Model/RawEmailJson.md @@ -0,0 +1,9 @@ +# # RawEmailJson + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/Recipient.md b/docs/Api/Model/Recipient.md new file mode 100644 index 00000000..e55e19c4 --- /dev/null +++ b/docs/Api/Model/Recipient.md @@ -0,0 +1,11 @@ +# # Recipient + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**raw_value** | **string** | | +**email_address** | **string** | | +**name** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ReplyToAliasEmailOptions.md b/docs/Api/Model/ReplyToAliasEmailOptions.md new file mode 100644 index 00000000..a58ea089 --- /dev/null +++ b/docs/Api/Model/ReplyToAliasEmailOptions.md @@ -0,0 +1,17 @@ +# # ReplyToAliasEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**body** | **string** | Body of the reply email you want to send | +**is_html** | **bool** | Is the reply HTML | +**charset** | **string** | The charset that your message should be sent with. Optional. Default is UTF-8 | [optional] +**attachments** | **string[]** | List of uploaded attachments to send with the reply. Optional. | [optional] +**template_variables** | **array** | Template variables if using a template | [optional] +**template** | **string** | Template ID to use instead of body. Will use template variable map to fill defined variable slots. | [optional] +**send_strategy** | **string** | How an email should be sent based on its recipients | [optional] +**use_inbox_name** | **bool** | Optionally use inbox name as display name for sender email address | [optional] +**html** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ReplyToEmailOptions.md b/docs/Api/Model/ReplyToEmailOptions.md new file mode 100644 index 00000000..379f4dbb --- /dev/null +++ b/docs/Api/Model/ReplyToEmailOptions.md @@ -0,0 +1,19 @@ +# # ReplyToEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**body** | **string** | Body of the reply email you want to send | +**is_html** | **bool** | Is the reply HTML | +**from** | **string** | The from header that should be used. Optional | [optional] +**reply_to** | **string** | The replyTo header that should be used. Optional | [optional] +**charset** | **string** | The charset that your message should be sent with. Optional. Default is UTF-8 | [optional] +**attachments** | **string[]** | List of uploaded attachments to send with the reply. Optional. | [optional] +**template_variables** | **array** | Template variables if using a template | [optional] +**template** | **string** | Template ID to use instead of body. Will use template variable map to fill defined variable slots. | [optional] +**send_strategy** | **string** | How an email should be sent based on its recipients | [optional] +**use_inbox_name** | **bool** | Optionally use inbox name as display name for sender email address | [optional] +**html** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ScheduledJob.md b/docs/Api/Model/ScheduledJob.md new file mode 100644 index 00000000..56b7f331 --- /dev/null +++ b/docs/Api/Model/ScheduledJob.md @@ -0,0 +1,18 @@ +# # ScheduledJob + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**inbox_id** | **string** | | +**job_id** | **string** | | +**group_id** | **string** | | +**trigger_id** | **string** | | +**status** | **string** | | +**send_at_timestamp** | **\DateTime** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ScheduledJobDto.md b/docs/Api/Model/ScheduledJobDto.md new file mode 100644 index 00000000..8964c819 --- /dev/null +++ b/docs/Api/Model/ScheduledJobDto.md @@ -0,0 +1,18 @@ +# # ScheduledJobDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**inbox_id** | **string** | | +**job_id** | **string** | | +**group_id** | **string** | | +**trigger_id** | **string** | | +**status** | **string** | | +**send_at_timestamp** | **\DateTime** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SendEmailOptions.md b/docs/Api/Model/SendEmailOptions.md new file mode 100644 index 00000000..8bd8ad54 --- /dev/null +++ b/docs/Api/Model/SendEmailOptions.md @@ -0,0 +1,28 @@ +# # SendEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to_contacts** | **string[]** | Optional list of contact IDs to send email to. Manage your contacts via the API or dashboard. When contacts are used the email is sent to each contact separately so they will not see other recipients. | [optional] +**to_group** | **string** | Optional contact group ID to send email to. You can create contacts and contact groups in the API or dashboard and use them for email campaigns. When contact groups are used the email is sent to each contact separately so they will not see other recipients | [optional] +**to** | **string[]** | List of destination email addresses. Each email address must be RFC 5322 format. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating). Be cautious when sending emails that your recipients exist. High bounce rates (meaning a high percentage of emails cannot be delivered because an address does not exist) can result in account freezing. | [optional] +**from** | **string** | Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets (`my@address.com` or `My inbox <my@address.com>`). If no sender is set the source inbox address will be used for this field. If you set `useInboxName` to `true` the from field will include the inbox name as a display name: `inbox_name <inbox@address.com>`. For this to work use the name field when creating an inbox. Beware of potential spam penalties when setting the from field to an address not used by the inbox. Your emails may get blocked by services if you impersonate another address. To use a custom email addresses use a custom domain. You can create domains with the DomainController. The domain must be verified in the dashboard before it can be used. | [optional] +**cc** | **string[]** | Optional list of cc destination email addresses | [optional] +**bcc** | **string[]** | Optional list of bcc destination email addresses | [optional] +**subject** | **string** | Optional email subject line | [optional] +**reply_to** | **string** | Optional replyTo header | [optional] +**body** | **string** | Optional contents of email. If body contains HTML then set `isHTML` to true to ensure that email clients render it correctly. You can use moustache template syntax in the email body in conjunction with `toGroup` contact variables or `templateVariables` data. If you need more templating control consider creating a template and using the `template` property instead of the body. | [optional] +**html** | **bool** | Optional HTML flag to indicate that contents is HTML. Set's a `content-type: text/html` for email. (Deprecated: use `isHTML` instead.) | [optional] +**is_html** | **bool** | Optional HTML flag. If true the `content-type` of the email will be `text/html`. Set to true when sending HTML to ensure proper rending on email clients | [optional] +**charset** | **string** | Optional charset | [optional] +**attachments** | **string[]** | Optional list of attachment IDs to send with this email. You must first upload each attachment separately via method call or dashboard in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded. There are several ways to upload that support `multi-part form`, `base64 file encoding`, and octet stream binary uploads. See the `UploadController` for available methods. | [optional] +**template_variables** | **array** | Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found. | [optional] +**template** | **string** | Optional template ID to use for body. Will override body if provided. When using a template make sure you pass the corresponding map of `templateVariables`. You can find which variables are needed by fetching the template itself or viewing it in the dashboard. | [optional] +**send_strategy** | **string** | How an email should be sent based on its recipients | [optional] +**use_inbox_name** | **bool** | Use name of inbox as sender email address name. Will construct RFC 5322 email address with `Inbox name <inbox@address.com>` if the inbox has a name. | [optional] +**add_tracking_pixel** | **bool** | Add tracking pixel to email | [optional] +**filter_bounced_recipients** | **bool** | Filter recipients to remove any bounced recipients from to, bcc, and cc before sending | [optional] +**validate_email_addresses** | **string** | Validate recipient email addresses before sending | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SendSMTPEnvelopeOptions.md b/docs/Api/Model/SendSMTPEnvelopeOptions.md new file mode 100644 index 00000000..bb2a5402 --- /dev/null +++ b/docs/Api/Model/SendSMTPEnvelopeOptions.md @@ -0,0 +1,11 @@ +# # SendSMTPEnvelopeOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rcpt_to** | **string[]** | | +**mail_from** | **string** | | +**data** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SendWithQueueResult.md b/docs/Api/Model/SendWithQueueResult.md new file mode 100644 index 00000000..d163c68e --- /dev/null +++ b/docs/Api/Model/SendWithQueueResult.md @@ -0,0 +1,18 @@ +# # SendWithQueueResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**subject** | **string** | | [optional] +**inbox_id** | **string** | | [optional] +**header_id** | **string** | | +**delivered** | **bool** | | +**exception_name** | **string** | | [optional] +**message** | **string** | | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/Sender.md b/docs/Api/Model/Sender.md new file mode 100644 index 00000000..d12a1c09 --- /dev/null +++ b/docs/Api/Model/Sender.md @@ -0,0 +1,11 @@ +# # Sender + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**raw_value** | **string** | | +**email_address** | **string** | | +**name** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SentEmailDto.md b/docs/Api/Model/SentEmailDto.md new file mode 100644 index 00000000..9edb0674 --- /dev/null +++ b/docs/Api/Model/SentEmailDto.md @@ -0,0 +1,33 @@ +# # SentEmailDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of sent email | +**user_id** | **string** | User ID | +**inbox_id** | **string** | Inbox ID email was sent from | +**domain_id** | **string** | Domain ID | [optional] +**to** | **string[]** | Recipients email was sent to | [optional] +**from** | **string** | Sent from address | [optional] +**reply_to** | **string** | | [optional] +**cc** | **string[]** | | [optional] +**bcc** | **string[]** | | [optional] +**attachments** | **string[]** | Array of IDs of attachments that were sent with this email | [optional] +**subject** | **string** | | [optional] +**body_md5_hash** | **string** | MD5 Hash | [optional] +**body** | **string** | Sent email body | [optional] +**to_contacts** | **string[]** | | [optional] +**to_group** | **string** | | [optional] +**charset** | **string** | | [optional] +**is_html** | **bool** | | [optional] +**sent_at** | **\DateTime** | | +**pixel_ids** | **string[]** | | [optional] +**message_id** | **string** | | [optional] +**message_ids** | **string[]** | | [optional] +**virtual_send** | **bool** | | [optional] +**template_id** | **string** | | [optional] +**template_variables** | **array** | | [optional] +**html** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SentEmailProjection.md b/docs/Api/Model/SentEmailProjection.md new file mode 100644 index 00000000..5b1f618d --- /dev/null +++ b/docs/Api/Model/SentEmailProjection.md @@ -0,0 +1,20 @@ +# # SentEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**from** | **string** | | [optional] +**user_id** | **string** | | +**subject** | **string** | | [optional] +**inbox_id** | **string** | | +**attachments** | **string[]** | | +**created_at** | **\DateTime** | | +**to** | **string[]** | | +**bcc** | **string[]** | | +**cc** | **string[]** | | +**body_md5_hash** | **string** | | [optional] +**virtual_send** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SetInboxFavouritedOptions.md b/docs/Api/Model/SetInboxFavouritedOptions.md new file mode 100644 index 00000000..cb47a2d0 --- /dev/null +++ b/docs/Api/Model/SetInboxFavouritedOptions.md @@ -0,0 +1,9 @@ +# # SetInboxFavouritedOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | **bool** | Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SimpleSendEmailOptions.md b/docs/Api/Model/SimpleSendEmailOptions.md new file mode 100644 index 00000000..a837fc9f --- /dev/null +++ b/docs/Api/Model/SimpleSendEmailOptions.md @@ -0,0 +1,12 @@ +# # SimpleSendEmailOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender_id** | **string** | ID of inbox to send from. If null an inbox will be created for sending | [optional] +**to** | **string** | Email address to send to | +**body** | **string** | Body of the email message. Supports HTML | [optional] +**subject** | **string** | Subject line of the email | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SmsDto.md b/docs/Api/Model/SmsDto.md new file mode 100644 index 00000000..6f581972 --- /dev/null +++ b/docs/Api/Model/SmsDto.md @@ -0,0 +1,16 @@ +# # SmsDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**phone_number** | **string** | | +**from_number** | **string** | | +**body** | **string** | | +**read** | **bool** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SmsMatchOption.md b/docs/Api/Model/SmsMatchOption.md new file mode 100644 index 00000000..2a284955 --- /dev/null +++ b/docs/Api/Model/SmsMatchOption.md @@ -0,0 +1,11 @@ +# # SmsMatchOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field** | **string** | Fields of an SMS object that can be used to filter results | +**should** | **string** | How the value of the email field specified should be compared to the value given in the match options. | +**value** | **string** | The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SmsPreview.md b/docs/Api/Model/SmsPreview.md new file mode 100644 index 00000000..e2b98b00 --- /dev/null +++ b/docs/Api/Model/SmsPreview.md @@ -0,0 +1,14 @@ +# # SmsPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**user_id** | **string** | | +**body** | **string** | | +**phone_number** | **string** | | +**from_number** | **string** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/SmsProjection.md b/docs/Api/Model/SmsProjection.md new file mode 100644 index 00000000..0e819f3a --- /dev/null +++ b/docs/Api/Model/SmsProjection.md @@ -0,0 +1,15 @@ +# # SmsProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**body** | **string** | | +**user_id** | **string** | | +**created_at** | **\DateTime** | | +**phone_number** | **string** | | +**from_number** | **string** | | +**read** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/Sort.md b/docs/Api/Model/Sort.md new file mode 100644 index 00000000..df6b6980 --- /dev/null +++ b/docs/Api/Model/Sort.md @@ -0,0 +1,11 @@ +# # Sort + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**empty** | **bool** | | [optional] +**sorted** | **bool** | | [optional] +**unsorted** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TemplateDto.md b/docs/Api/Model/TemplateDto.md new file mode 100644 index 00000000..1780eb7c --- /dev/null +++ b/docs/Api/Model/TemplateDto.md @@ -0,0 +1,13 @@ +# # TemplateDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of template | +**name** | **string** | Template name | +**variables** | [**\MailSlurp\Models\TemplateVariable[]**](TemplateVariable) | Variables available in template that can be replaced with values | +**content** | **string** | Content of the template | +**created_at** | **\DateTime** | Created at time | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TemplatePreview.md b/docs/Api/Model/TemplatePreview.md new file mode 100644 index 00000000..e16e0d8f --- /dev/null +++ b/docs/Api/Model/TemplatePreview.md @@ -0,0 +1,9 @@ +# # TemplatePreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**preview** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TemplateProjection.md b/docs/Api/Model/TemplateProjection.md new file mode 100644 index 00000000..bd74d540 --- /dev/null +++ b/docs/Api/Model/TemplateProjection.md @@ -0,0 +1,13 @@ +# # TemplateProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**id** | **string** | | +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**variables** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TemplateVariable.md b/docs/Api/Model/TemplateVariable.md new file mode 100644 index 00000000..66792e95 --- /dev/null +++ b/docs/Api/Model/TemplateVariable.md @@ -0,0 +1,10 @@ +# # TemplateVariable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of variable. This can be used in a template as {{name}} | +**variable_type** | **string** | The type of variable | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TestNewInboxForwarderOptions.md b/docs/Api/Model/TestNewInboxForwarderOptions.md new file mode 100644 index 00000000..e5538c9e --- /dev/null +++ b/docs/Api/Model/TestNewInboxForwarderOptions.md @@ -0,0 +1,10 @@ +# # TestNewInboxForwarderOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_forwarder_test_options** | [**\MailSlurp\Models\InboxForwarderTestOptions**](InboxForwarderTestOptions) | | +**create_inbox_forwarder_options** | [**\MailSlurp\Models\CreateInboxForwarderOptions**](CreateInboxForwarderOptions) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TestNewInboxRulesetOptions.md b/docs/Api/Model/TestNewInboxRulesetOptions.md new file mode 100644 index 00000000..4ff0a566 --- /dev/null +++ b/docs/Api/Model/TestNewInboxRulesetOptions.md @@ -0,0 +1,10 @@ +# # TestNewInboxRulesetOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_ruleset_test_options** | [**\MailSlurp\Models\InboxRulesetTestOptions**](InboxRulesetTestOptions) | | +**create_inbox_ruleset_options** | [**\MailSlurp\Models\CreateInboxRulesetOptions**](CreateInboxRulesetOptions) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TestPhoneNumberOptions.md b/docs/Api/Model/TestPhoneNumberOptions.md new file mode 100644 index 00000000..e065b659 --- /dev/null +++ b/docs/Api/Model/TestPhoneNumberOptions.md @@ -0,0 +1,9 @@ +# # TestPhoneNumberOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ThreadProjection.md b/docs/Api/Model/ThreadProjection.md new file mode 100644 index 00000000..ee3885ee --- /dev/null +++ b/docs/Api/Model/ThreadProjection.md @@ -0,0 +1,19 @@ +# # ThreadProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of thread | [optional] +**id** | **string** | ID of email thread | +**subject** | **string** | Thread subject | [optional] +**inbox_id** | **string** | Inbox ID | +**user_id** | **string** | User ID | +**created_at** | **\DateTime** | Created at DateTime | +**updated_at** | **\DateTime** | Updated at DateTime | +**to** | **string[]** | To recipients | +**bcc** | **string[]** | BCC recipients | [optional] +**cc** | **string[]** | CC recipients | [optional] +**alias_id** | **string** | Alias ID | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TrackingPixelDto.md b/docs/Api/Model/TrackingPixelDto.md new file mode 100644 index 00000000..357b02fe --- /dev/null +++ b/docs/Api/Model/TrackingPixelDto.md @@ -0,0 +1,17 @@ +# # TrackingPixelDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**seen** | **bool** | | +**recipient** | **string** | | [optional] +**html** | **string** | | +**url** | **string** | | +**inbox_id** | **string** | | [optional] +**sent_email_id** | **string** | | [optional] +**seen_at** | **\DateTime** | | [optional] +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/TrackingPixelProjection.md b/docs/Api/Model/TrackingPixelProjection.md new file mode 100644 index 00000000..162bdbfc --- /dev/null +++ b/docs/Api/Model/TrackingPixelProjection.md @@ -0,0 +1,17 @@ +# # TrackingPixelProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**id** | **string** | | +**inbox_id** | **string** | | [optional] +**user_id** | **string** | | +**created_at** | **\DateTime** | | +**sent_email_id** | **string** | | [optional] +**recipient** | **string** | | [optional] +**seen** | **bool** | | +**seen_at** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UnknownMissedEmailProjection.md b/docs/Api/Model/UnknownMissedEmailProjection.md new file mode 100644 index 00000000..2bcbf17d --- /dev/null +++ b/docs/Api/Model/UnknownMissedEmailProjection.md @@ -0,0 +1,13 @@ +# # UnknownMissedEmailProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**from** | **string** | | [optional] +**subject** | **string** | | [optional] +**created_at** | **\DateTime** | | +**to** | **string[]** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UnreadCount.md b/docs/Api/Model/UnreadCount.md new file mode 100644 index 00000000..67a2b1ca --- /dev/null +++ b/docs/Api/Model/UnreadCount.md @@ -0,0 +1,9 @@ +# # UnreadCount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**count** | **int** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UnseenErrorCountDto.md b/docs/Api/Model/UnseenErrorCountDto.md new file mode 100644 index 00000000..376a40cb --- /dev/null +++ b/docs/Api/Model/UnseenErrorCountDto.md @@ -0,0 +1,9 @@ +# # UnseenErrorCountDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**count** | **int** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UpdateAliasOptions.md b/docs/Api/Model/UpdateAliasOptions.md new file mode 100644 index 00000000..7b71a1a3 --- /dev/null +++ b/docs/Api/Model/UpdateAliasOptions.md @@ -0,0 +1,9 @@ +# # UpdateAliasOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Optional name for alias | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UpdateDomainOptions.md b/docs/Api/Model/UpdateDomainOptions.md new file mode 100644 index 00000000..95709610 --- /dev/null +++ b/docs/Api/Model/UpdateDomainOptions.md @@ -0,0 +1,9 @@ +# # UpdateDomainOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**catch_all_inbox_id** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UpdateGroupContacts.md b/docs/Api/Model/UpdateGroupContacts.md new file mode 100644 index 00000000..91bf1a59 --- /dev/null +++ b/docs/Api/Model/UpdateGroupContacts.md @@ -0,0 +1,9 @@ +# # UpdateGroupContacts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contact_ids** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UpdateInboxOptions.md b/docs/Api/Model/UpdateInboxOptions.md new file mode 100644 index 00000000..7c455851 --- /dev/null +++ b/docs/Api/Model/UpdateInboxOptions.md @@ -0,0 +1,13 @@ +# # UpdateInboxOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search | [optional] +**description** | **string** | Description of an inbox for labelling and searching purposes | [optional] +**tags** | **string[]** | Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. | [optional] +**expires_at** | **\DateTime** | Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. | [optional] +**favourite** | **bool** | Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UploadAttachmentBytesRequest.md b/docs/Api/Model/UploadAttachmentBytesRequest.md new file mode 100644 index 00000000..88fc0c19 --- /dev/null +++ b/docs/Api/Model/UploadAttachmentBytesRequest.md @@ -0,0 +1,16 @@ +# # UploadAttachmentBytesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**short** | **int** | | [optional] +**char** | **string** | | [optional] +**int** | **int** | | [optional] +**long** | **int** | | [optional] +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**direct** | **bool** | | [optional] +**read_only** | **bool** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UploadAttachmentOptions.md b/docs/Api/Model/UploadAttachmentOptions.md new file mode 100644 index 00000000..3e6cf103 --- /dev/null +++ b/docs/Api/Model/UploadAttachmentOptions.md @@ -0,0 +1,11 @@ +# # UploadAttachmentOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content_type** | **string** | Optional contentType for file. For instance `application/pdf` | [optional] +**filename** | **string** | Optional filename to save upload with. Will be the name that is shown in email clients | [optional] +**base64_contents** | **string** | Base64 encoded string of file contents. Typically this means reading the bytes or string content of a file and then converting that to a base64 encoded string. For examples of how to do this see https://www.mailslurp.com/guides/base64-file-uploads/ | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UploadMultipartFormRequest.md b/docs/Api/Model/UploadMultipartFormRequest.md new file mode 100644 index 00000000..883fc2f0 --- /dev/null +++ b/docs/Api/Model/UploadMultipartFormRequest.md @@ -0,0 +1,10 @@ +# # UploadMultipartFormRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content_type_header** | **string** | Optional content type header of attachment | [optional] +**file** | **\SplFileObject** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/UserInfoDto.md b/docs/Api/Model/UserInfoDto.md new file mode 100644 index 00000000..45223ea5 --- /dev/null +++ b/docs/Api/Model/UserInfoDto.md @@ -0,0 +1,14 @@ +# # UserInfoDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | +**email_address** | **string** | | +**account_state** | **string** | | +**subscription_type** | **string** | | [optional] +**account_type** | **string** | | +**created_at** | **\DateTime** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ValidateEmailAddressListOptions.md b/docs/Api/Model/ValidateEmailAddressListOptions.md new file mode 100644 index 00000000..c08c6044 --- /dev/null +++ b/docs/Api/Model/ValidateEmailAddressListOptions.md @@ -0,0 +1,9 @@ +# # ValidateEmailAddressListOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email_address_list** | **string[]** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ValidateEmailAddressListResult.md b/docs/Api/Model/ValidateEmailAddressListResult.md new file mode 100644 index 00000000..e99c0f32 --- /dev/null +++ b/docs/Api/Model/ValidateEmailAddressListResult.md @@ -0,0 +1,11 @@ +# # ValidateEmailAddressListResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid_email_addresses** | **string[]** | | +**invalid_email_addresses** | **string[]** | | +**result_map_email_address_is_valid** | **array** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ValidationDto.md b/docs/Api/Model/ValidationDto.md new file mode 100644 index 00000000..ec57b540 --- /dev/null +++ b/docs/Api/Model/ValidationDto.md @@ -0,0 +1,10 @@ +# # ValidationDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email_id** | **string** | ID of the email validated | +**html** | [**\MailSlurp\Models\HTMLValidationResult**](HTMLValidationResult) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/ValidationMessage.md b/docs/Api/Model/ValidationMessage.md new file mode 100644 index 00000000..0bd3c241 --- /dev/null +++ b/docs/Api/Model/ValidationMessage.md @@ -0,0 +1,10 @@ +# # ValidationMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**line_number** | **int** | | +**message** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/VerifyEmailAddressOptions.md b/docs/Api/Model/VerifyEmailAddressOptions.md new file mode 100644 index 00000000..95a0512e --- /dev/null +++ b/docs/Api/Model/VerifyEmailAddressOptions.md @@ -0,0 +1,12 @@ +# # VerifyEmailAddressOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mail_server_domain** | **string** | | [optional] +**email_address** | **string** | | +**sender_email_address** | **string** | | [optional] +**port** | **int** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/VerifyWebhookSignatureOptions.md b/docs/Api/Model/VerifyWebhookSignatureOptions.md new file mode 100644 index 00000000..3f3f85e5 --- /dev/null +++ b/docs/Api/Model/VerifyWebhookSignatureOptions.md @@ -0,0 +1,10 @@ +# # VerifyWebhookSignatureOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | | +**signature** | **string** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/VerifyWebhookSignatureResults.md b/docs/Api/Model/VerifyWebhookSignatureResults.md new file mode 100644 index 00000000..33432a4a --- /dev/null +++ b/docs/Api/Model/VerifyWebhookSignatureResults.md @@ -0,0 +1,9 @@ +# # VerifyWebhookSignatureResults + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is_valid** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WaitForConditions.md b/docs/Api/Model/WaitForConditions.md new file mode 100644 index 00000000..27ba3c01 --- /dev/null +++ b/docs/Api/Model/WaitForConditions.md @@ -0,0 +1,18 @@ +# # WaitForConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inbox_id** | **string** | ID of inbox to search within and apply conditions to. Essentially filtering the emails found to give a count. | +**count** | **int** | Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation. | [optional] +**delay_timeout** | **int** | Max time in milliseconds to wait between retries if a `timeout` is specified. | [optional] +**timeout** | **int** | Max time in milliseconds to retry the `waitFor` operation until conditions are met. | +**unread_only** | **bool** | Apply conditions only to **unread** emails. All emails begin with `read=false`. An email is marked `read=true` when an `EmailDto` representation of it has been returned to the user at least once. For example you have called `getEmail` or `waitForLatestEmail` etc., or you have viewed the email in the dashboard. | [optional] +**count_type** | **string** | How result size should be compared with the expected size. Exactly or at-least matching result? | [optional] +**matches** | [**\MailSlurp\Models\MatchOption[]**](MatchOption) | Conditions that should be matched for an email to qualify for results. Each condition will be applied in order to each email within an inbox to filter a result list of matching emails you are waiting for. | [optional] +**sort_direction** | **string** | Direction to sort matching emails by created time | [optional] +**since** | **\DateTime** | ISO Date Time earliest time of email to consider. Filter for matching emails that were received after this date | [optional] +**before** | **\DateTime** | ISO Date Time latest time of email to consider. Filter for matching emails that were received before this date | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WaitForSingleSmsOptions.md b/docs/Api/Model/WaitForSingleSmsOptions.md new file mode 100644 index 00000000..d7751fdc --- /dev/null +++ b/docs/Api/Model/WaitForSingleSmsOptions.md @@ -0,0 +1,15 @@ +# # WaitForSingleSmsOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_number_id** | **string** | | +**timeout** | **int** | | +**unread_only** | **bool** | | [optional] +**before** | **\DateTime** | | [optional] +**since** | **\DateTime** | | [optional] +**sort_direction** | **string** | | [optional] +**delay** | **int** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WaitForSmsConditions.md b/docs/Api/Model/WaitForSmsConditions.md new file mode 100644 index 00000000..827e14b0 --- /dev/null +++ b/docs/Api/Model/WaitForSmsConditions.md @@ -0,0 +1,19 @@ +# # WaitForSmsConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_number_id** | **string** | ID of phone number to search within and apply conditions to. Essentially filtering the SMS found to give a count. | +**limit** | **int** | Limit results | [optional] +**count** | **int** | Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation. | +**delay_timeout** | **int** | Max time in milliseconds to wait between retries if a `timeout` is specified. | [optional] +**timeout** | **int** | Max time in milliseconds to retry the `waitFor` operation until conditions are met. | +**unread_only** | **bool** | Apply conditions only to **unread** SMS. All SMS messages begin with `read=false`. An SMS is marked `read=true` when an `SMS` has been returned to the user at least once. For example you have called `getSms` or `waitForSms` etc., or you have viewed the SMS in the dashboard. | [optional] +**count_type** | **string** | How result size should be compared with the expected size. Exactly or at-least matching result? | [optional] +**matches** | [**\MailSlurp\Models\SmsMatchOption[]**](SmsMatchOption) | Conditions that should be matched for an SMS to qualify for results. Each condition will be applied in order to each SMS within a phone number to filter a result list of matching SMSs you are waiting for. | [optional] +**sort_direction** | **string** | Direction to sort matching SMSs by created time | [optional] +**since** | **\DateTime** | ISO Date Time earliest time of SMS to consider. Filter for matching SMSs that were received after this date | [optional] +**before** | **\DateTime** | ISO Date Time latest time of SMS to consider. Filter for matching SMSs that were received before this date | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookBouncePayload.md b/docs/Api/Model/WebhookBouncePayload.md new file mode 100644 index 00000000..6e665922 --- /dev/null +++ b/docs/Api/Model/WebhookBouncePayload.md @@ -0,0 +1,16 @@ +# # WebhookBouncePayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**bounce_id** | **string** | ID of the bounce email record. Use the ID with the bounce controller to view more information | +**sent_to_recipients** | **string[]** | Email sent to recipients | [optional] +**sender** | **string** | Sender causing bounce | +**bounce_recipients** | **string[]** | Email addresses that resulted in a bounce or email being rejected. Please save these recipients and avoid emailing them in the future to maintain your reputation. | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookBounceRecipientPayload.md b/docs/Api/Model/WebhookBounceRecipientPayload.md new file mode 100644 index 00000000..7c99aa55 --- /dev/null +++ b/docs/Api/Model/WebhookBounceRecipientPayload.md @@ -0,0 +1,13 @@ +# # WebhookBounceRecipientPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**recipient** | **string** | Email address that caused a bounce. Make note of the address and try not to message it again to preserve your reputation. | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookDeliveryStatusPayload.md b/docs/Api/Model/WebhookDeliveryStatusPayload.md new file mode 100644 index 00000000..b45ef7c8 --- /dev/null +++ b/docs/Api/Model/WebhookDeliveryStatusPayload.md @@ -0,0 +1,24 @@ +# # WebhookDeliveryStatusPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**id** | **string** | ID of delivery status | +**user_id** | **string** | User ID of event | +**sent_id** | **string** | ID of sent email | [optional] +**remote_mta_ip** | **string** | IP address of the remote Mail Transfer Agent | [optional] +**inbox_id** | **string** | Id of the inbox | [optional] +**reporting_mta** | **string** | Mail Transfer Agent reporting delivery status | [optional] +**recipients** | **string[]** | Recipients for delivery | [optional] +**smtp_response** | **string** | SMTP server response message | [optional] +**smtp_status_code** | **int** | SMTP server status | [optional] +**processing_time_millis** | **int** | Time in milliseconds for delivery processing | [optional] +**received** | **\DateTime** | Time event was received | [optional] +**subject** | **string** | Email subject | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookDto.md b/docs/Api/Model/WebhookDto.md new file mode 100644 index 00000000..cf312655 --- /dev/null +++ b/docs/Api/Model/WebhookDto.md @@ -0,0 +1,22 @@ +# # WebhookDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the Webhook | +**user_id** | **string** | User ID of the Webhook | +**basic_auth** | **bool** | Does webhook expect basic authentication? If true it means you created this webhook with a username and password. MailSlurp will use these in the URL to authenticate itself. | +**name** | **string** | Name of the webhook | [optional] +**phone_id** | **string** | The phoneNumberId that the Webhook will be triggered by. If null then webhook triggered at account level or inbox level if inboxId set | [optional] +**inbox_id** | **string** | The inbox that the Webhook will be triggered by. If null then webhook triggered at account level or phone level if phoneId set | [optional] +**request_body_template** | **string** | Request body template for HTTP request that will be sent for the webhook. Use Moustache style template variables to insert values from the original event payload. | [optional] +**url** | **string** | URL of your server that the webhook will be sent to. The schema of the JSON that is sent is described by the payloadJsonSchema. | +**method** | **string** | HTTP method that your server endpoint must listen for | +**payload_json_schema** | **string** | Deprecated. Fetch JSON Schema for webhook using the getJsonSchemaForWebhookPayload method | +**created_at** | **\DateTime** | When the webhook was created | +**updated_at** | **\DateTime** | | +**event_name** | **string** | Webhook trigger event name | [optional] +**request_headers** | [**\MailSlurp\Models\WebhookHeaders**](WebhookHeaders) | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookEmailOpenedPayload.md b/docs/Api/Model/WebhookEmailOpenedPayload.md new file mode 100644 index 00000000..8c32cf8f --- /dev/null +++ b/docs/Api/Model/WebhookEmailOpenedPayload.md @@ -0,0 +1,17 @@ +# # WebhookEmailOpenedPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**inbox_id** | **string** | Id of the inbox | +**pixel_id** | **string** | ID of the tracking pixel | +**sent_email_id** | **string** | ID of sent email | +**recipient** | **string** | Email address for the recipient of the tracking pixel | +**created_at** | **\DateTime** | Date time of event creation | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookEmailReadPayload.md b/docs/Api/Model/WebhookEmailReadPayload.md new file mode 100644 index 00000000..f50600f1 --- /dev/null +++ b/docs/Api/Model/WebhookEmailReadPayload.md @@ -0,0 +1,16 @@ +# # WebhookEmailReadPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**email_id** | **string** | ID of the email that was received. Use this ID for fetching the email with the `EmailController`. | +**inbox_id** | **string** | Id of the inbox | +**email_is_read** | **bool** | Is the email read | +**created_at** | **\DateTime** | Date time of event creation | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookHeaderNameValue.md b/docs/Api/Model/WebhookHeaderNameValue.md new file mode 100644 index 00000000..a6c49bb8 --- /dev/null +++ b/docs/Api/Model/WebhookHeaderNameValue.md @@ -0,0 +1,10 @@ +# # WebhookHeaderNameValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of header | +**value** | **string** | Value of header | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookHeaders.md b/docs/Api/Model/WebhookHeaders.md new file mode 100644 index 00000000..e7eb3bc8 --- /dev/null +++ b/docs/Api/Model/WebhookHeaders.md @@ -0,0 +1,9 @@ +# # WebhookHeaders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**headers** | [**\MailSlurp\Models\WebhookHeaderNameValue[]**](WebhookHeaderNameValue) | List of header name value pairs to include with webhook requests | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookNewAttachmentPayload.md b/docs/Api/Model/WebhookNewAttachmentPayload.md new file mode 100644 index 00000000..68e1b77b --- /dev/null +++ b/docs/Api/Model/WebhookNewAttachmentPayload.md @@ -0,0 +1,16 @@ +# # WebhookNewAttachmentPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**attachment_id** | **string** | ID of attachment. Use the `AttachmentController` to | +**name** | **string** | Filename of the attachment if present | +**content_type** | **string** | Content type of attachment such as 'image/png' or 'application/pdf | +**content_length** | **int** | Size of attachment in bytes | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookNewContactPayload.md b/docs/Api/Model/WebhookNewContactPayload.md new file mode 100644 index 00000000..db9f36ca --- /dev/null +++ b/docs/Api/Model/WebhookNewContactPayload.md @@ -0,0 +1,23 @@ +# # WebhookNewContactPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**contact_id** | **string** | Contact ID | +**group_id** | **string** | Contact group ID | [optional] +**first_name** | **string** | Contact first name | [optional] +**last_name** | **string** | Contact last name | [optional] +**company** | **string** | Contact company name | [optional] +**primary_email_address** | **string** | Primary email address for contact | [optional] +**email_addresses** | **string[]** | Email addresses for contact | +**tags** | **string[]** | Tags for contact | +**meta_data** | **object** | | [optional] +**opt_out** | **bool** | Has contact opted out of emails | +**created_at** | **\DateTime** | Date time of event creation | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookNewEmailPayload.md b/docs/Api/Model/WebhookNewEmailPayload.md new file mode 100644 index 00000000..a15c8a59 --- /dev/null +++ b/docs/Api/Model/WebhookNewEmailPayload.md @@ -0,0 +1,22 @@ +# # WebhookNewEmailPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**inbox_id** | **string** | Id of the inbox | +**domain_id** | **string** | Id of the domain that received an email | [optional] +**email_id** | **string** | ID of the email that was received. Use this ID for fetching the email with the `EmailController`. | +**created_at** | **\DateTime** | Date time of event creation | +**to** | **string[]** | List of `To` recipient email addresses that the email was addressed to. See recipients object for names. | +**from** | **string** | Who the email was sent from. An email address - see fromName for the sender name. | +**cc** | **string[]** | List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. | +**bcc** | **string[]** | List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. | +**subject** | **string** | The subject line of the email message as specified by SMTP subject header | [optional] +**attachment_meta_datas** | [**\MailSlurp\Models\AttachmentMetaData[]**](AttachmentMetaData) | List of attachment meta data objects if attachments present | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookNewSmsPayload.md b/docs/Api/Model/WebhookNewSmsPayload.md new file mode 100644 index 00000000..592a3a15 --- /dev/null +++ b/docs/Api/Model/WebhookNewSmsPayload.md @@ -0,0 +1,19 @@ +# # WebhookNewSmsPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Idempotent message ID. Store this ID locally or in a database to prevent message duplication. | +**webhook_id** | **string** | ID of webhook entity being triggered | +**event_name** | **string** | Name of the event type webhook is being triggered for. | +**webhook_name** | **string** | Name of the webhook being triggered | [optional] +**sms_id** | **string** | ID of SMS message | +**user_id** | **string** | User ID of event | +**phone_number** | **string** | ID of phone number receiving SMS | +**to_number** | **string** | Recipient phone number | +**from_number** | **string** | Sender phone number | +**body** | **string** | SMS message body | +**read** | **bool** | SMS has been read | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookProjection.md b/docs/Api/Model/WebhookProjection.md new file mode 100644 index 00000000..37d7a38b --- /dev/null +++ b/docs/Api/Model/WebhookProjection.md @@ -0,0 +1,16 @@ +# # WebhookProjection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**id** | **string** | | +**url** | **string** | | +**inbox_id** | **string** | | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**event_name** | **string** | | [optional] +**phone_number_id** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookRedriveResult.md b/docs/Api/Model/WebhookRedriveResult.md new file mode 100644 index 00000000..f202b05a --- /dev/null +++ b/docs/Api/Model/WebhookRedriveResult.md @@ -0,0 +1,11 @@ +# # WebhookRedriveResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**webhook_result_id** | **string** | | +**success** | **bool** | | +**message** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookResultDto.md b/docs/Api/Model/WebhookResultDto.md new file mode 100644 index 00000000..a2178387 --- /dev/null +++ b/docs/Api/Model/WebhookResultDto.md @@ -0,0 +1,24 @@ +# # WebhookResultDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**user_id** | **string** | | +**inbox_id** | **string** | | [optional] +**webhook_id** | **string** | | +**webhook_url** | **string** | | +**message_id** | **string** | | +**redrive_id** | **string** | | [optional] +**http_method** | **string** | | +**webhook_event** | **string** | | +**response_status** | **int** | | [optional] +**response_time_millis** | **int** | | +**response_body_extract** | **string** | | [optional] +**result_type** | **string** | | [optional] +**created_at** | **\DateTime** | | +**updated_at** | **\DateTime** | | +**seen** | **bool** | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookTestRequest.md b/docs/Api/Model/WebhookTestRequest.md new file mode 100644 index 00000000..8489b97e --- /dev/null +++ b/docs/Api/Model/WebhookTestRequest.md @@ -0,0 +1,12 @@ +# # WebhookTestRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | | +**method** | **string** | | +**headers** | **array** | | +**payload** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookTestResponse.md b/docs/Api/Model/WebhookTestResponse.md new file mode 100644 index 00000000..d1277022 --- /dev/null +++ b/docs/Api/Model/WebhookTestResponse.md @@ -0,0 +1,10 @@ +# # WebhookTestResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status_code** | **int** | | [optional] +**message** | **string** | | [optional] + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/Model/WebhookTestResult.md b/docs/Api/Model/WebhookTestResult.md new file mode 100644 index 00000000..ecd40e7a --- /dev/null +++ b/docs/Api/Model/WebhookTestResult.md @@ -0,0 +1,11 @@ +# # WebhookTestResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | | [optional] +**response** | [**\MailSlurp\Models\WebhookTestResponse**](WebhookTestResponse) | | +**request** | [**\MailSlurp\Models\WebhookTestRequest**](WebhookTestRequest) | | + +[[Back to Model list]](../../README#models) [[Back to API list]](../../README#endpoints) [[Back to README]](../../README) diff --git a/docs/Api/PhoneControllerApi.md b/docs/Api/PhoneControllerApi.md new file mode 100644 index 00000000..2ca9f5b5 --- /dev/null +++ b/docs/Api/PhoneControllerApi.md @@ -0,0 +1,562 @@ +# MailSlurp\PhoneControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createEmergencyAddress()**](PhoneControllerApi#createEmergencyAddress) | **POST** /phone/emergency-addresses | | +| [**deleteEmergencyAddress()**](PhoneControllerApi#deleteEmergencyAddress) | **DELETE** /phone/emergency-addresses/{addressId} | | +| [**deletePhoneNumber()**](PhoneControllerApi#deletePhoneNumber) | **DELETE** /phone/numbers/{phoneNumberId} | | +| [**getEmergencyAddress()**](PhoneControllerApi#getEmergencyAddress) | **GET** /phone/emergency-addresses/{addressId} | | +| [**getEmergencyAddresses()**](PhoneControllerApi#getEmergencyAddresses) | **GET** /phone/emergency-addresses | | +| [**getPhoneNumber()**](PhoneControllerApi#getPhoneNumber) | **GET** /phone/numbers/{phoneNumberId} | | +| [**getPhoneNumbers()**](PhoneControllerApi#getPhoneNumbers) | **GET** /phone/numbers | | +| [**getPhonePlans()**](PhoneControllerApi#getPhonePlans) | **GET** /phone/plans | | +| [**testPhoneNumberSendSms()**](PhoneControllerApi#testPhoneNumberSendSms) | **POST** /phone/numbers/{phoneNumberId}/test | | + + +## `createEmergencyAddress()` + +```php +createEmergencyAddress($create_emergency_address_options): \MailSlurp\Models\EmergencyAddress +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_emergency_address_options = new \MailSlurp\Models\CreateEmergencyAddressOptions(); // \MailSlurp\Models\CreateEmergencyAddressOptions + +try { + $result = $apiInstance->createEmergencyAddress($create_emergency_address_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->createEmergencyAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_emergency_address_options** | [**\MailSlurp\Models\CreateEmergencyAddressOptions**](../Model/CreateEmergencyAddressOptions)| | | + +### Return type + +[**\MailSlurp\Models\EmergencyAddress**](../Model/EmergencyAddress) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteEmergencyAddress()` + +```php +deleteEmergencyAddress($address_id): \MailSlurp\Models\EmptyResponseDto +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$address_id = 'address_id_example'; // string + +try { + $result = $apiInstance->deleteEmergencyAddress($address_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->deleteEmergencyAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **address_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\EmptyResponseDto**](../Model/EmptyResponseDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deletePhoneNumber()` + +```php +deletePhoneNumber($phone_number_id) +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number_id = 'phone_number_id_example'; // string + +try { + $apiInstance->deletePhoneNumber($phone_number_id); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->deletePhoneNumber: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmergencyAddress()` + +```php +getEmergencyAddress($address_id): \MailSlurp\Models\EmergencyAddress +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$address_id = 'address_id_example'; // string + +try { + $result = $apiInstance->getEmergencyAddress($address_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->getEmergencyAddress: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **address_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\EmergencyAddress**](../Model/EmergencyAddress) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getEmergencyAddresses()` + +```php +getEmergencyAddresses(): \MailSlurp\Models\EmergencyAddressDto[] +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getEmergencyAddresses(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->getEmergencyAddresses: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\EmergencyAddressDto[]**](../Model/EmergencyAddressDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getPhoneNumber()` + +```php +getPhoneNumber($phone_number_id): \MailSlurp\Models\PhoneNumberDto +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number_id = 'phone_number_id_example'; // string + +try { + $result = $apiInstance->getPhoneNumber($phone_number_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->getPhoneNumber: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\PhoneNumberDto**](../Model/PhoneNumberDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getPhoneNumbers()` + +```php +getPhoneNumbers($phone_country, $page, $size, $sort, $since, $before): \MailSlurp\Models\PagePhoneNumberProjection +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_country = 'phone_country_example'; // string | Optional phone country +$page = 0; // int | Optional page index for list pagination +$size = 20; // int | Optional page size for list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getPhoneNumbers($phone_country, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->getPhoneNumbers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_country** | **string**| Optional phone country | [optional] | +| **page** | **int**| Optional page index for list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size for list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PagePhoneNumberProjection**](../Model/PagePhoneNumberProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getPhonePlans()` + +```php +getPhonePlans(): \MailSlurp\Models\PhonePlanDto[] +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getPhonePlans(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->getPhonePlans: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\PhonePlanDto[]**](../Model/PhonePlanDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `testPhoneNumberSendSms()` + +```php +testPhoneNumberSendSms($phone_number_id, $test_phone_number_options, $x_test_id) +``` + + + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\PhoneControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number_id = 'phone_number_id_example'; // string +$test_phone_number_options = new \MailSlurp\Models\TestPhoneNumberOptions(); // \MailSlurp\Models\TestPhoneNumberOptions +$x_test_id = 'x_test_id_example'; // string + +try { + $apiInstance->testPhoneNumberSendSms($phone_number_id, $test_phone_number_options, $x_test_id); +} catch (Exception $e) { + echo 'Exception when calling PhoneControllerApi->testPhoneNumberSendSms: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number_id** | **string**| | | +| **test_phone_number_options** | [**\MailSlurp\Models\TestPhoneNumberOptions**](../Model/TestPhoneNumberOptions)| | | +| **x_test_id** | **string**| | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/SentEmailsControllerApi.md b/docs/Api/SentEmailsControllerApi.md new file mode 100644 index 00000000..5d41c7d2 --- /dev/null +++ b/docs/Api/SentEmailsControllerApi.md @@ -0,0 +1,1080 @@ +# MailSlurp\SentEmailsControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**deleteAllSentEmails()**](SentEmailsControllerApi#deleteAllSentEmails) | **DELETE** /sent | Delete all sent email receipts | +| [**deleteSentEmail()**](SentEmailsControllerApi#deleteSentEmail) | **DELETE** /sent/{id} | Delete sent email receipt | +| [**getAllSentTrackingPixels()**](SentEmailsControllerApi#getAllSentTrackingPixels) | **GET** /sent/tracking-pixels | | +| [**getRawSentEmailContents()**](SentEmailsControllerApi#getRawSentEmailContents) | **GET** /sent/{emailId}/raw | Get raw sent email string. Returns unparsed raw SMTP message with headers and body. | +| [**getRawSentEmailJson()**](SentEmailsControllerApi#getRawSentEmailJson) | **GET** /sent/{emailId}/raw/json | Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. | +| [**getSentDeliveryStatus()**](SentEmailsControllerApi#getSentDeliveryStatus) | **GET** /sent/delivery-status/{deliveryId} | | +| [**getSentDeliveryStatuses()**](SentEmailsControllerApi#getSentDeliveryStatuses) | **GET** /sent/delivery-status | | +| [**getSentDeliveryStatusesBySentId()**](SentEmailsControllerApi#getSentDeliveryStatusesBySentId) | **GET** /sent/{sentId}/delivery-status | | +| [**getSentEmail()**](SentEmailsControllerApi#getSentEmail) | **GET** /sent/{id} | Get sent email receipt | +| [**getSentEmailHTMLContent()**](SentEmailsControllerApi#getSentEmailHTMLContent) | **GET** /sent/{id}/html | Get sent email HTML content | +| [**getSentEmailPreviewURLs()**](SentEmailsControllerApi#getSentEmailPreviewURLs) | **GET** /sent/{id}/urls | Get sent email URL for viewing in browser or downloading | +| [**getSentEmailTrackingPixels()**](SentEmailsControllerApi#getSentEmailTrackingPixels) | **GET** /sent/{id}/tracking-pixels | | +| [**getSentEmails()**](SentEmailsControllerApi#getSentEmails) | **GET** /sent | Get all sent emails in paginated form | +| [**getSentEmailsWithQueueResults()**](SentEmailsControllerApi#getSentEmailsWithQueueResults) | **GET** /sent/queue-results | Get results of email sent with queues in paginated form | +| [**getSentOrganizationEmails()**](SentEmailsControllerApi#getSentOrganizationEmails) | **GET** /sent/organization | | +| [**waitForDeliveryStatuses()**](SentEmailsControllerApi#waitForDeliveryStatuses) | **GET** /sent/delivery-status/wait-for | | + + +## `deleteAllSentEmails()` + +```php +deleteAllSentEmails() +``` + +Delete all sent email receipts + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->deleteAllSentEmails(); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->deleteAllSentEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteSentEmail()` + +```php +deleteSentEmail($id) +``` + +Delete sent email receipt + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $apiInstance->deleteSentEmail($id); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->deleteSentEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllSentTrackingPixels()` + +```php +getAllSentTrackingPixels($page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageTrackingPixelProjection +``` + + + +Get all sent email tracking pixels in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in sent email tracking pixel list pagination +$size = 20; // int | Optional page size in sent email tracking pixel list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllSentTrackingPixels($page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getAllSentTrackingPixels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in sent email tracking pixel list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in sent email tracking pixel list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageTrackingPixelProjection**](../Model/PageTrackingPixelProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getRawSentEmailContents()` + +```php +getRawSentEmailContents($email_id): string +``` + +Get raw sent email string. Returns unparsed raw SMTP message with headers and body. + +Returns a raw, unparsed, and unprocessed sent email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawSentEmailJson endpoint + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->getRawSentEmailContents($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getRawSentEmailContents: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/plain` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getRawSentEmailJson()` + +```php +getRawSentEmailJson($email_id): \MailSlurp\Models\RawEmailJson +``` + +Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. + +Returns a raw, unparsed, and unprocessed sent email wrapped in a JSON response object for easier handling when compared with the getRawSentEmail text/plain response + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$email_id = 'email_id_example'; // string | ID of email + +try { + $result = $apiInstance->getRawSentEmailJson($email_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getRawSentEmailJson: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **email_id** | **string**| ID of email | | + +### Return type + +[**\MailSlurp\Models\RawEmailJson**](../Model/RawEmailJson) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentDeliveryStatus()` + +```php +getSentDeliveryStatus($delivery_id): \MailSlurp\Models\DeliveryStatusDto +``` + + + +Get a sent email delivery status + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$delivery_id = 'delivery_id_example'; // string + +try { + $result = $apiInstance->getSentDeliveryStatus($delivery_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentDeliveryStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **delivery_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\DeliveryStatusDto**](../Model/DeliveryStatusDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentDeliveryStatuses()` + +```php +getSentDeliveryStatuses($page, $size, $sort, $since, $before): \MailSlurp\Models\PageDeliveryStatus +``` + + + +Get all sent email delivery statuses + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in delivery status list pagination +$size = 20; // int | Optional page size in delivery status list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentDeliveryStatuses($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentDeliveryStatuses: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in delivery status list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in delivery status list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageDeliveryStatus**](../Model/PageDeliveryStatus) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentDeliveryStatusesBySentId()` + +```php +getSentDeliveryStatusesBySentId($sent_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageDeliveryStatus +``` + + + +Get all sent email delivery statuses + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sent_id = 'sent_id_example'; // string +$page = 0; // int | Optional page index in delivery status list pagination +$size = 20; // int | Optional page size in delivery status list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentDeliveryStatusesBySentId($sent_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentDeliveryStatusesBySentId: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sent_id** | **string**| | | +| **page** | **int**| Optional page index in delivery status list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in delivery status list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageDeliveryStatus**](../Model/PageDeliveryStatus) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmail()` + +```php +getSentEmail($id): \MailSlurp\Models\SentEmailDto +``` + +Get sent email receipt + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getSentEmail($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\SentEmailDto**](../Model/SentEmailDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmailHTMLContent()` + +```php +getSentEmailHTMLContent($id): string +``` + +Get sent email HTML content + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getSentEmailHTMLContent($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmailHTMLContent: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/html` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmailPreviewURLs()` + +```php +getSentEmailPreviewURLs($id): \MailSlurp\Models\EmailPreviewUrls +``` + +Get sent email URL for viewing in browser or downloading + +Get a list of URLs for sent email content as text/html or raw SMTP message for viewing the message in a browser. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getSentEmailPreviewURLs($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmailPreviewURLs: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\EmailPreviewUrls**](../Model/EmailPreviewUrls) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmailTrackingPixels()` + +```php +getSentEmailTrackingPixels($id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageTrackingPixelProjection +``` + + + +Get all tracking pixels for a sent email in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string +$page = 0; // int | Optional page index in sent email tracking pixel list pagination +$size = 20; // int | Optional page size in sent email tracking pixel list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentEmailTrackingPixels($id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmailTrackingPixels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **page** | **int**| Optional page index in sent email tracking pixel list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in sent email tracking pixel list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageTrackingPixelProjection**](../Model/PageTrackingPixelProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmails()` + +```php +getSentEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageSentEmailProjection +``` + +Get all sent emails in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inboxId to filter sender of sent emails by +$page = 0; // int | Optional page index in inbox sent email list pagination +$size = 20; // int | Optional page size in inbox sent email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inboxId to filter sender of sent emails by | [optional] | +| **page** | **int**| Optional page index in inbox sent email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox sent email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageSentEmailProjection**](../Model/PageSentEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentEmailsWithQueueResults()` + +```php +getSentEmailsWithQueueResults($page, $size, $sort, $since, $before): \MailSlurp\Models\PageSentEmailWithQueueProjection +``` + +Get results of email sent with queues in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in inbox sent email list pagination +$size = 20; // int | Optional page size in inbox sent email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentEmailsWithQueueResults($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentEmailsWithQueueResults: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in inbox sent email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in inbox sent email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageSentEmailWithQueueProjection**](../Model/PageSentEmailWithQueueProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSentOrganizationEmails()` + +```php +getSentOrganizationEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageSentEmailProjection +``` + + + +Get all sent organization emails in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Optional inboxId to filter sender of sent emails by +$page = 0; // int | Optional page index in sent email list pagination +$size = 20; // int | Optional page size in sent email list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getSentOrganizationEmails($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->getSentOrganizationEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Optional inboxId to filter sender of sent emails by | [optional] | +| **page** | **int**| Optional page index in sent email list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in sent email list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageSentEmailProjection**](../Model/PageSentEmailProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForDeliveryStatuses()` + +```php +waitForDeliveryStatuses($sent_id, $inbox_id, $timeout, $index, $since, $before): \MailSlurp\Models\DeliveryStatusDto +``` + + + +Wait for delivery statuses + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SentEmailsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sent_id = 'sent_id_example'; // string | Optional sent email ID filter +$inbox_id = 'inbox_id_example'; // string | Optional inbox ID filter +$timeout = 56; // int | Optional timeout milliseconds +$index = 56; // int | Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->waitForDeliveryStatuses($sent_id, $inbox_id, $timeout, $index, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SentEmailsControllerApi->waitForDeliveryStatuses: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sent_id** | **string**| Optional sent email ID filter | [optional] | +| **inbox_id** | **string**| Optional inbox ID filter | [optional] | +| **timeout** | **int**| Optional timeout milliseconds | [optional] | +| **index** | **int**| Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\DeliveryStatusDto**](../Model/DeliveryStatusDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/SmsControllerApi.md b/docs/Api/SmsControllerApi.md new file mode 100644 index 00000000..cd74cbb6 --- /dev/null +++ b/docs/Api/SmsControllerApi.md @@ -0,0 +1,269 @@ +# MailSlurp\SmsControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**deleteSmsMessage()**](SmsControllerApi#deleteSmsMessage) | **DELETE** /sms/{smsId} | Delete SMS message. | +| [**deleteSmsMessages()**](SmsControllerApi#deleteSmsMessages) | **DELETE** /sms | Delete all SMS messages | +| [**getSmsMessage()**](SmsControllerApi#getSmsMessage) | **GET** /sms/{smsId} | Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. | +| [**getSmsMessagesPaginated()**](SmsControllerApi#getSmsMessagesPaginated) | **GET** /sms | Get all SMS messages in all phone numbers in paginated form. . | + + +## `deleteSmsMessage()` + +```php +deleteSmsMessage($sms_id) +``` + +Delete SMS message. + +Delete an SMS message + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SmsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sms_id = 'sms_id_example'; // string + +try { + $apiInstance->deleteSmsMessage($sms_id); +} catch (Exception $e) { + echo 'Exception when calling SmsControllerApi->deleteSmsMessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sms_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteSmsMessages()` + +```php +deleteSmsMessages($phone_number_id) +``` + +Delete all SMS messages + +Delete all SMS messages or all messages for a given phone number + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SmsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number_id = 'phone_number_id_example'; // string + +try { + $apiInstance->deleteSmsMessages($phone_number_id); +} catch (Exception $e) { + echo 'Exception when calling SmsControllerApi->deleteSmsMessages: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number_id** | **string**| | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSmsMessage()` + +```php +getSmsMessage($sms_id): \MailSlurp\Models\SmsDto +``` + +Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. + +Returns a SMS summary object with content. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SmsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sms_id = 'sms_id_example'; // string + +try { + $result = $apiInstance->getSmsMessage($sms_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SmsControllerApi->getSmsMessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sms_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\SmsDto**](../Model/SmsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getSmsMessagesPaginated()` + +```php +getSmsMessagesPaginated($phone_number, $page, $size, $sort, $unread_only, $since, $before): \MailSlurp\Models\PageSmsProjection +``` + +Get all SMS messages in all phone numbers in paginated form. . + +By default returns all SMS messages across all phone numbers sorted by ascending created at date. Responses are paginated. You can restrict results to a list of phone number IDs. You can also filter out read messages + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\SmsControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number = 'phone_number_example'; // string | Optional receiving phone number to filter SMS messages for +$page = 0; // int | Optional page index in SMS list pagination +$size = 20; // int | Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$unread_only = false; // bool | Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter SMSs received after given date time +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Optional filter SMSs received before given date time + +try { + $result = $apiInstance->getSmsMessagesPaginated($phone_number, $page, $size, $sort, $unread_only, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SmsControllerApi->getSmsMessagesPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number** | **string**| Optional receiving phone number to filter SMS messages for | [optional] | +| **page** | **int**| Optional page index in SMS list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **unread_only** | **bool**| Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly | [optional] [default to false] | +| **since** | **\DateTime**| Optional filter SMSs received after given date time | [optional] | +| **before** | **\DateTime**| Optional filter SMSs received before given date time | [optional] | + +### Return type + +[**\MailSlurp\Models\PageSmsProjection**](../Model/PageSmsProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/TemplateControllerApi.md b/docs/Api/TemplateControllerApi.md new file mode 100644 index 00000000..47c1ebab --- /dev/null +++ b/docs/Api/TemplateControllerApi.md @@ -0,0 +1,517 @@ +# MailSlurp\TemplateControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createTemplate()**](TemplateControllerApi#createTemplate) | **POST** /templates | Create a Template | +| [**deleteTemplate()**](TemplateControllerApi#deleteTemplate) | **DELETE** /templates/{templateId} | Delete email template | +| [**getAllTemplates()**](TemplateControllerApi#getAllTemplates) | **GET** /templates/paginated | List templates | +| [**getTemplate()**](TemplateControllerApi#getTemplate) | **GET** /templates/{templateId} | Get template | +| [**getTemplatePreviewHtml()**](TemplateControllerApi#getTemplatePreviewHtml) | **GET** /templates/{templateId}/preview/html | Get template preview HTML | +| [**getTemplatePreviewJson()**](TemplateControllerApi#getTemplatePreviewJson) | **GET** /templates/{templateId}/preview/json | Get template preview Json | +| [**getTemplates()**](TemplateControllerApi#getTemplates) | **GET** /templates | List templates | +| [**updateTemplate()**](TemplateControllerApi#updateTemplate) | **PUT** /templates/{templateId} | Update template | + + +## `createTemplate()` + +```php +createTemplate($create_template_options): \MailSlurp\Models\TemplateDto +``` + +Create a Template + +Create an email template with variables for use with templated transactional emails. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_template_options = new \MailSlurp\Models\CreateTemplateOptions(); // \MailSlurp\Models\CreateTemplateOptions + +try { + $result = $apiInstance->createTemplate($create_template_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->createTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_template_options** | [**\MailSlurp\Models\CreateTemplateOptions**](../Model/CreateTemplateOptions)| | | + +### Return type + +[**\MailSlurp\Models\TemplateDto**](../Model/TemplateDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteTemplate()` + +```php +deleteTemplate($template_id) +``` + +Delete email template + +Delete template + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$template_id = 'template_id_example'; // string | Template ID + +try { + $apiInstance->deleteTemplate($template_id); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->deleteTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| Template ID | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllTemplates()` + +```php +getAllTemplates($page, $size, $sort, $since, $before): \MailSlurp\Models\PageTemplateProjection +``` + +List templates + +Get all templates in paginated format + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllTemplates($page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->getAllTemplates: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageTemplateProjection**](../Model/PageTemplateProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTemplate()` + +```php +getTemplate($template_id): \MailSlurp\Models\TemplateDto +``` + +Get template + +Get email template + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$template_id = 'template_id_example'; // string | Template ID + +try { + $result = $apiInstance->getTemplate($template_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->getTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| Template ID | | + +### Return type + +[**\MailSlurp\Models\TemplateDto**](../Model/TemplateDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTemplatePreviewHtml()` + +```php +getTemplatePreviewHtml($template_id): string +``` + +Get template preview HTML + +Get email template preview with passed template variables in HTML format for browsers. Pass template variables as query params. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$template_id = 'template_id_example'; // string | Template ID + +try { + $result = $apiInstance->getTemplatePreviewHtml($template_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->getTemplatePreviewHtml: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| Template ID | | + +### Return type + +**string** + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/html;charset=utf-8`, `text/html` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTemplatePreviewJson()` + +```php +getTemplatePreviewJson($template_id): \MailSlurp\Models\TemplatePreview +``` + +Get template preview Json + +Get email template preview with passed template variables in JSON format. Pass template variables as query params. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$template_id = 'template_id_example'; // string | Template ID + +try { + $result = $apiInstance->getTemplatePreviewJson($template_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->getTemplatePreviewJson: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| Template ID | | + +### Return type + +[**\MailSlurp\Models\TemplatePreview**](../Model/TemplatePreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTemplates()` + +```php +getTemplates(): \MailSlurp\Models\TemplateProjection[] +``` + +List templates + +Get all templates + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTemplates(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->getTemplates: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\TemplateProjection[]**](../Model/TemplateProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateTemplate()` + +```php +updateTemplate($template_id, $create_template_options): \MailSlurp\Models\TemplateDto +``` + +Update template + +Update email template + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TemplateControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$template_id = 'template_id_example'; // string | Template ID +$create_template_options = new \MailSlurp\Models\CreateTemplateOptions(); // \MailSlurp\Models\CreateTemplateOptions + +try { + $result = $apiInstance->updateTemplate($template_id, $create_template_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TemplateControllerApi->updateTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| Template ID | | +| **create_template_options** | [**\MailSlurp\Models\CreateTemplateOptions**](../Model/CreateTemplateOptions)| | | + +### Return type + +[**\MailSlurp\Models\TemplateDto**](../Model/TemplateDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/TrackingControllerApi.md b/docs/Api/TrackingControllerApi.md new file mode 100644 index 00000000..2a38b889 --- /dev/null +++ b/docs/Api/TrackingControllerApi.md @@ -0,0 +1,204 @@ +# MailSlurp\TrackingControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createTrackingPixel()**](TrackingControllerApi#createTrackingPixel) | **POST** /tracking/pixels | Create tracking pixel | +| [**getAllTrackingPixels()**](TrackingControllerApi#getAllTrackingPixels) | **GET** /tracking/pixels | Get tracking pixels | +| [**getTrackingPixel()**](TrackingControllerApi#getTrackingPixel) | **GET** /tracking/pixels/{id} | Get pixel | + + +## `createTrackingPixel()` + +```php +createTrackingPixel($create_tracking_pixel_options): \MailSlurp\Models\TrackingPixelDto +``` + +Create tracking pixel + +Create a tracking pixel. A tracking pixel is an image that can be embedded in an email. When the email is viewed and the image is seen MailSlurp will mark the pixel as seen. Use tracking pixels to monitor email open events. You can receive open notifications via webhook or by fetching the pixel. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TrackingControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_tracking_pixel_options = new \MailSlurp\Models\CreateTrackingPixelOptions(); // \MailSlurp\Models\CreateTrackingPixelOptions + +try { + $result = $apiInstance->createTrackingPixel($create_tracking_pixel_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TrackingControllerApi->createTrackingPixel: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_tracking_pixel_options** | [**\MailSlurp\Models\CreateTrackingPixelOptions**](../Model/CreateTrackingPixelOptions)| | | + +### Return type + +[**\MailSlurp\Models\TrackingPixelDto**](../Model/TrackingPixelDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllTrackingPixels()` + +```php +getAllTrackingPixels($page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageTrackingPixelProjection +``` + +Get tracking pixels + +List tracking pixels in paginated form + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TrackingControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllTrackingPixels($page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TrackingControllerApi->getAllTrackingPixels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageTrackingPixelProjection**](../Model/PageTrackingPixelProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTrackingPixel()` + +```php +getTrackingPixel($id): \MailSlurp\Models\TrackingPixelDto +``` + +Get pixel + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\TrackingControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 'id_example'; // string + +try { + $result = $apiInstance->getTrackingPixel($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TrackingControllerApi->getTrackingPixel: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\TrackingPixelDto**](../Model/TrackingPixelDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/WaitForControllerApi.md b/docs/Api/WaitForControllerApi.md new file mode 100644 index 00000000..cebd2cc8 --- /dev/null +++ b/docs/Api/WaitForControllerApi.md @@ -0,0 +1,581 @@ +# MailSlurp\WaitForControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**waitFor()**](WaitForControllerApi#waitFor) | **POST** /waitFor | Wait for an email to match the provided filter conditions such as subject contains keyword. | +| [**waitForEmailCount()**](WaitForControllerApi#waitForEmailCount) | **GET** /waitForEmailCount | Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs | +| [**waitForLatestEmail()**](WaitForControllerApi#waitForLatestEmail) | **GET** /waitForLatestEmail | Fetch inbox's latest email or if empty wait for an email to arrive | +| [**waitForLatestSms()**](WaitForControllerApi#waitForLatestSms) | **POST** /waitForLatestSms | Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. | +| [**waitForMatchingEmails()**](WaitForControllerApi#waitForMatchingEmails) | **POST** /waitForMatchingEmails | Wait or return list of emails that match simple matching patterns | +| [**waitForMatchingFirstEmail()**](WaitForControllerApi#waitForMatchingFirstEmail) | **POST** /waitForMatchingFirstEmail | Wait for or return the first email that matches provided MatchOptions array | +| [**waitForNthEmail()**](WaitForControllerApi#waitForNthEmail) | **GET** /waitForNthEmail | Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. | +| [**waitForSms()**](WaitForControllerApi#waitForSms) | **POST** /waitForSms | Wait for an SMS message to match the provided filter conditions such as body contains keyword. | + + +## `waitFor()` + +```php +waitFor($wait_for_conditions): \MailSlurp\Models\EmailPreview[] +``` + +Wait for an email to match the provided filter conditions such as subject contains keyword. + +Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$wait_for_conditions = new \MailSlurp\Models\WaitForConditions(); // \MailSlurp\Models\WaitForConditions + +try { + $result = $apiInstance->waitFor($wait_for_conditions); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitFor: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **wait_for_conditions** | [**\MailSlurp\Models\WaitForConditions**](../Model/WaitForConditions)| | | + +### Return type + +[**\MailSlurp\Models\EmailPreview[]**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForEmailCount()` + +```php +waitForEmailCount($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay): \MailSlurp\Models\EmailPreview[] +``` + +Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs + +If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of the inbox we are fetching emails from +$count = 56; // int | Number of emails to wait for. Must be greater that 1 +$timeout = 56; // int | Max milliseconds to wait +$unread_only = false; // bool | Optional filter for unread only +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received before the given timestamp +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received after the given timestamp +$sort = 'sort_example'; // string | Sort direction +$delay = 56; // int | Max milliseconds delay between calls + +try { + $result = $apiInstance->waitForEmailCount($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForEmailCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of the inbox we are fetching emails from | | +| **count** | **int**| Number of emails to wait for. Must be greater that 1 | | +| **timeout** | **int**| Max milliseconds to wait | [optional] | +| **unread_only** | **bool**| Optional filter for unread only | [optional] [default to false] | +| **before** | **\DateTime**| Filter for emails that were received before the given timestamp | [optional] | +| **since** | **\DateTime**| Filter for emails that were received after the given timestamp | [optional] | +| **sort** | **string**| Sort direction | [optional] | +| **delay** | **int**| Max milliseconds delay between calls | [optional] | + +### Return type + +[**\MailSlurp\Models\EmailPreview[]**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForLatestEmail()` + +```php +waitForLatestEmail($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay): \MailSlurp\Models\Email +``` + +Fetch inbox's latest email or if empty wait for an email to arrive + +Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of the inbox we are fetching emails from +$timeout = 56; // int | Max milliseconds to wait +$unread_only = false; // bool | Optional filter for unread only. +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were before after the given timestamp +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received after the given timestamp +$sort = 'sort_example'; // string | Sort direction +$delay = 56; // int | Max milliseconds delay between calls + +try { + $result = $apiInstance->waitForLatestEmail($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForLatestEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of the inbox we are fetching emails from | [optional] | +| **timeout** | **int**| Max milliseconds to wait | [optional] | +| **unread_only** | **bool**| Optional filter for unread only. | [optional] [default to false] | +| **before** | **\DateTime**| Filter for emails that were before after the given timestamp | [optional] | +| **since** | **\DateTime**| Filter for emails that were received after the given timestamp | [optional] | +| **sort** | **string**| Sort direction | [optional] | +| **delay** | **int**| Max milliseconds delay between calls | [optional] | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForLatestSms()` + +```php +waitForLatestSms($wait_for_single_sms_options): \MailSlurp\Models\SmsDto +``` + +Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. + +Wait until a phone number meets given conditions or return immediately if already met + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$wait_for_single_sms_options = new \MailSlurp\Models\WaitForSingleSmsOptions(); // \MailSlurp\Models\WaitForSingleSmsOptions + +try { + $result = $apiInstance->waitForLatestSms($wait_for_single_sms_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForLatestSms: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **wait_for_single_sms_options** | [**\MailSlurp\Models\WaitForSingleSmsOptions**](../Model/WaitForSingleSmsOptions)| | | + +### Return type + +[**\MailSlurp\Models\SmsDto**](../Model/SmsDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForMatchingEmails()` + +```php +waitForMatchingEmails($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only): \MailSlurp\Models\EmailPreview[] +``` + +Wait or return list of emails that match simple matching patterns + +Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of the inbox we are fetching emails from +$count = 56; // int | Number of emails to wait for. Must be greater or equal to 1 +$match_options = new \MailSlurp\Models\MatchOptions(); // \MailSlurp\Models\MatchOptions +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received before the given timestamp +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received after the given timestamp +$sort = 'sort_example'; // string | Sort direction +$delay = 56; // int | Max milliseconds delay between calls +$timeout = 56; // int | Max milliseconds to wait +$unread_only = false; // bool | Optional filter for unread only + +try { + $result = $apiInstance->waitForMatchingEmails($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForMatchingEmails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of the inbox we are fetching emails from | | +| **count** | **int**| Number of emails to wait for. Must be greater or equal to 1 | | +| **match_options** | [**\MailSlurp\Models\MatchOptions**](../Model/MatchOptions)| | | +| **before** | **\DateTime**| Filter for emails that were received before the given timestamp | [optional] | +| **since** | **\DateTime**| Filter for emails that were received after the given timestamp | [optional] | +| **sort** | **string**| Sort direction | [optional] | +| **delay** | **int**| Max milliseconds delay between calls | [optional] | +| **timeout** | **int**| Max milliseconds to wait | [optional] | +| **unread_only** | **bool**| Optional filter for unread only | [optional] [default to false] | + +### Return type + +[**\MailSlurp\Models\EmailPreview[]**](../Model/EmailPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForMatchingFirstEmail()` + +```php +waitForMatchingFirstEmail($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay): \MailSlurp\Models\Email +``` + +Wait for or return the first email that matches provided MatchOptions array + +Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of the inbox we are matching an email for +$match_options = new \MailSlurp\Models\MatchOptions(); // \MailSlurp\Models\MatchOptions +$timeout = 56; // int | Max milliseconds to wait +$unread_only = false; // bool | Optional filter for unread only +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received before the given timestamp +$sort = 'sort_example'; // string | Sort direction +$delay = 56; // int | Max milliseconds delay between calls + +try { + $result = $apiInstance->waitForMatchingFirstEmail($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForMatchingFirstEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of the inbox we are matching an email for | | +| **match_options** | [**\MailSlurp\Models\MatchOptions**](../Model/MatchOptions)| | | +| **timeout** | **int**| Max milliseconds to wait | [optional] | +| **unread_only** | **bool**| Optional filter for unread only | [optional] [default to false] | +| **since** | **\DateTime**| Filter for emails that were received after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter for emails that were received before the given timestamp | [optional] | +| **sort** | **string**| Sort direction | [optional] | +| **delay** | **int**| Max milliseconds delay between calls | [optional] | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForNthEmail()` + +```php +waitForNthEmail($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay): \MailSlurp\Models\Email +``` + +Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. + +If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string | Id of the inbox you are fetching emails from +$index = 0; // int | Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 +$timeout = 56; // int | Max milliseconds to wait for the nth email if not already present +$unread_only = false; // bool | Optional filter for unread only +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter for emails that were received before the given timestamp +$sort = 'sort_example'; // string | Sort direction +$delay = 56; // int | Max milliseconds delay between calls + +try { + $result = $apiInstance->waitForNthEmail($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForNthEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| Id of the inbox you are fetching emails from | [optional] | +| **index** | **int**| Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 | [optional] [default to 0] | +| **timeout** | **int**| Max milliseconds to wait for the nth email if not already present | [optional] | +| **unread_only** | **bool**| Optional filter for unread only | [optional] [default to false] | +| **since** | **\DateTime**| Filter for emails that were received after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter for emails that were received before the given timestamp | [optional] | +| **sort** | **string**| Sort direction | [optional] | +| **delay** | **int**| Max milliseconds delay between calls | [optional] | + +### Return type + +[**\MailSlurp\Models\Email**](../Model/Email) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `waitForSms()` + +```php +waitForSms($wait_for_sms_conditions): \MailSlurp\Models\SmsPreview[] +``` + +Wait for an SMS message to match the provided filter conditions such as body contains keyword. + +Generic waitFor method that will wait until a phone number meets given conditions or return immediately if already met + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WaitForControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$wait_for_sms_conditions = new \MailSlurp\Models\WaitForSmsConditions(); // \MailSlurp\Models\WaitForSmsConditions + +try { + $result = $apiInstance->waitForSms($wait_for_sms_conditions); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WaitForControllerApi->waitForSms: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **wait_for_sms_conditions** | [**\MailSlurp\Models\WaitForSmsConditions**](../Model/WaitForSmsConditions)| | | + +### Return type + +[**\MailSlurp\Models\SmsPreview[]**](../Model/SmsPreview) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/docs/Api/WebhookControllerApi.md b/docs/Api/WebhookControllerApi.md new file mode 100644 index 00000000..66f06c46 --- /dev/null +++ b/docs/Api/WebhookControllerApi.md @@ -0,0 +1,2097 @@ +# MailSlurp\WebhookControllerApi + +All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createAccountWebhook()**](WebhookControllerApi#createAccountWebhook) | **POST** /webhooks | Attach a WebHook URL to an inbox | +| [**createWebhook()**](WebhookControllerApi#createWebhook) | **POST** /inboxes/{inboxId}/webhooks | Attach a WebHook URL to an inbox | +| [**createWebhookForPhoneNumber()**](WebhookControllerApi#createWebhookForPhoneNumber) | **POST** /phone/numbers/{phoneNumberId}/webhooks | Attach a WebHook URL to a phone number | +| [**deleteAllWebhooks()**](WebhookControllerApi#deleteAllWebhooks) | **DELETE** /webhooks | Delete all webhooks | +| [**deleteWebhook()**](WebhookControllerApi#deleteWebhook) | **DELETE** /inboxes/{inboxId}/webhooks/{webhookId} | Delete and disable a Webhook for an Inbox | +| [**deleteWebhookById()**](WebhookControllerApi#deleteWebhookById) | **DELETE** /webhooks/{webhookId} | Delete a webhook | +| [**getAllAccountWebhooks()**](WebhookControllerApi#getAllAccountWebhooks) | **GET** /webhooks/account/paginated | List account webhooks Paginated | +| [**getAllWebhookResults()**](WebhookControllerApi#getAllWebhookResults) | **GET** /webhooks/results | Get results for all webhooks | +| [**getAllWebhooks()**](WebhookControllerApi#getAllWebhooks) | **GET** /webhooks/paginated | List Webhooks Paginated | +| [**getInboxWebhooksPaginated()**](WebhookControllerApi#getInboxWebhooksPaginated) | **GET** /inboxes/{inboxId}/webhooks/paginated | Get paginated webhooks for an Inbox | +| [**getJsonSchemaForWebhookEvent()**](WebhookControllerApi#getJsonSchemaForWebhookEvent) | **POST** /webhooks/schema | | +| [**getJsonSchemaForWebhookPayload()**](WebhookControllerApi#getJsonSchemaForWebhookPayload) | **POST** /webhooks/{webhookId}/schema | | +| [**getPhoneNumberWebhooksPaginated()**](WebhookControllerApi#getPhoneNumberWebhooksPaginated) | **GET** /phone/numbers/{phoneId}/webhooks/paginated | Get paginated webhooks for a phone number | +| [**getTestWebhookPayload()**](WebhookControllerApi#getTestWebhookPayload) | **GET** /webhooks/test | | +| [**getTestWebhookPayloadBounce()**](WebhookControllerApi#getTestWebhookPayloadBounce) | **GET** /webhooks/test/email-bounce-payload | | +| [**getTestWebhookPayloadBounceRecipient()**](WebhookControllerApi#getTestWebhookPayloadBounceRecipient) | **GET** /webhooks/test/email-bounce-recipient-payload | | +| [**getTestWebhookPayloadDeliveryStatus()**](WebhookControllerApi#getTestWebhookPayloadDeliveryStatus) | **GET** /webhooks/test/delivery-status-payload | Get webhook test payload for delivery status event | +| [**getTestWebhookPayloadEmailOpened()**](WebhookControllerApi#getTestWebhookPayloadEmailOpened) | **GET** /webhooks/test/email-opened-payload | | +| [**getTestWebhookPayloadEmailRead()**](WebhookControllerApi#getTestWebhookPayloadEmailRead) | **GET** /webhooks/test/email-read-payload | | +| [**getTestWebhookPayloadForWebhook()**](WebhookControllerApi#getTestWebhookPayloadForWebhook) | **POST** /webhooks/{webhookId}/example | | +| [**getTestWebhookPayloadNewAttachment()**](WebhookControllerApi#getTestWebhookPayloadNewAttachment) | **GET** /webhooks/test/new-attachment-payload | Get webhook test payload for new attachment event | +| [**getTestWebhookPayloadNewContact()**](WebhookControllerApi#getTestWebhookPayloadNewContact) | **GET** /webhooks/test/new-contact-payload | Get webhook test payload for new contact event | +| [**getTestWebhookPayloadNewEmail()**](WebhookControllerApi#getTestWebhookPayloadNewEmail) | **GET** /webhooks/test/new-email-payload | Get webhook test payload for new email event | +| [**getTestWebhookPayloadNewSms()**](WebhookControllerApi#getTestWebhookPayloadNewSms) | **GET** /webhooks/test/new-sms-payload | Get webhook test payload for new sms event | +| [**getWebhook()**](WebhookControllerApi#getWebhook) | **GET** /webhooks/{webhookId} | Get a webhook | +| [**getWebhookResult()**](WebhookControllerApi#getWebhookResult) | **GET** /webhooks/results/{webhookResultId} | Get a webhook result for a webhook | +| [**getWebhookResults()**](WebhookControllerApi#getWebhookResults) | **GET** /webhooks/{webhookId}/results | Get a webhook results for a webhook | +| [**getWebhookResultsUnseenErrorCount()**](WebhookControllerApi#getWebhookResultsUnseenErrorCount) | **GET** /webhooks/results/unseen-count | Get count of unseen webhook results with error status | +| [**getWebhooks()**](WebhookControllerApi#getWebhooks) | **GET** /inboxes/{inboxId}/webhooks | Get all webhooks for an Inbox | +| [**redriveWebhookResult()**](WebhookControllerApi#redriveWebhookResult) | **POST** /webhooks/results/{webhookResultId}/redrive | Get a webhook result and try to resend the original webhook payload | +| [**sendTestData()**](WebhookControllerApi#sendTestData) | **POST** /webhooks/{webhookId}/test | Send webhook test data | +| [**updateWebhookHeaders()**](WebhookControllerApi#updateWebhookHeaders) | **PUT** /webhooks/{webhookId}/headers | Update a webhook request headers | +| [**verifyWebhookSignature()**](WebhookControllerApi#verifyWebhookSignature) | **POST** /webhooks/verify | Verify a webhook payload signature | + + +## `createAccountWebhook()` + +```php +createAccountWebhook($create_webhook_options): \MailSlurp\Models\WebhookDto +``` + +Attach a WebHook URL to an inbox + +Get notified of account level events such as bounce and bounce recipient. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$create_webhook_options = new \MailSlurp\Models\CreateWebhookOptions(); // \MailSlurp\Models\CreateWebhookOptions + +try { + $result = $apiInstance->createAccountWebhook($create_webhook_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->createAccountWebhook: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_webhook_options** | [**\MailSlurp\Models\CreateWebhookOptions**](../Model/CreateWebhookOptions)| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createWebhook()` + +```php +createWebhook($inbox_id, $create_webhook_options): \MailSlurp\Models\WebhookDto +``` + +Attach a WebHook URL to an inbox + +Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$create_webhook_options = new \MailSlurp\Models\CreateWebhookOptions(); // \MailSlurp\Models\CreateWebhookOptions + +try { + $result = $apiInstance->createWebhook($inbox_id, $create_webhook_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->createWebhook: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **create_webhook_options** | [**\MailSlurp\Models\CreateWebhookOptions**](../Model/CreateWebhookOptions)| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `createWebhookForPhoneNumber()` + +```php +createWebhookForPhoneNumber($phone_number_id, $create_webhook_options): \MailSlurp\Models\WebhookDto +``` + +Attach a WebHook URL to a phone number + +Get notified whenever a phone number receives an SMS via a WebHook URL. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_number_id = 'phone_number_id_example'; // string +$create_webhook_options = new \MailSlurp\Models\CreateWebhookOptions(); // \MailSlurp\Models\CreateWebhookOptions + +try { + $result = $apiInstance->createWebhookForPhoneNumber($phone_number_id, $create_webhook_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->createWebhookForPhoneNumber: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_number_id** | **string**| | | +| **create_webhook_options** | [**\MailSlurp\Models\CreateWebhookOptions**](../Model/CreateWebhookOptions)| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteAllWebhooks()` + +```php +deleteAllWebhooks($before) +``` + +Delete all webhooks + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | before + +try { + $apiInstance->deleteAllWebhooks($before); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->deleteAllWebhooks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **before** | **\DateTime**| before | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteWebhook()` + +```php +deleteWebhook($inbox_id, $webhook_id) +``` + +Delete and disable a Webhook for an Inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$webhook_id = 'webhook_id_example'; // string + +try { + $apiInstance->deleteWebhook($inbox_id, $webhook_id); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->deleteWebhook: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **webhook_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `deleteWebhookById()` + +```php +deleteWebhookById($webhook_id) +``` + +Delete a webhook + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string + +try { + $apiInstance->deleteWebhookById($webhook_id); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->deleteWebhookById: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllAccountWebhooks()` + +```php +getAllAccountWebhooks($page, $size, $sort, $event_type, $since, $before): \MailSlurp\Models\PageWebhookProjection +``` + +List account webhooks Paginated + +List account webhooks in paginated form. Allows for page index, page size, and sort direction. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size for paginated result list. +$sort = 'DESC'; // string | Optional createdAt sort direction ASC or DESC +$event_type = 'event_type_example'; // string | Optional event type +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllAccountWebhooks($page, $size, $sort, $event_type, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getAllAccountWebhooks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size for paginated result list. | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'DESC'] | +| **event_type** | **string**| Optional event type | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookProjection**](../Model/PageWebhookProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllWebhookResults()` + +```php +getAllWebhookResults($page, $size, $sort, $search_filter, $since, $before, $unseen_only): \MailSlurp\Models\PageWebhookResult +``` + +Get results for all webhooks + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp +$unseen_only = True; // bool | Filter for unseen exceptions only + +try { + $result = $apiInstance->getAllWebhookResults($page, $size, $sort, $search_filter, $since, $before, $unseen_only); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getAllWebhookResults: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | +| **unseen_only** | **bool**| Filter for unseen exceptions only | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookResult**](../Model/PageWebhookResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getAllWebhooks()` + +```php +getAllWebhooks($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before): \MailSlurp\Models\PageWebhookProjection +``` + +List Webhooks Paginated + +List webhooks in paginated form. Allows for page index, page size, and sort direction. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size for paginated result list. +$sort = 'DESC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$inbox_id = 'inbox_id_example'; // string | Filter by inboxId +$phone_id = 'phone_id_example'; // string | Filter by phoneId +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getAllWebhooks($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getAllWebhooks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size for paginated result list. | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'DESC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **inbox_id** | **string**| Filter by inboxId | [optional] | +| **phone_id** | **string**| Filter by phoneId | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookProjection**](../Model/PageWebhookProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getInboxWebhooksPaginated()` + +```php +getInboxWebhooksPaginated($inbox_id, $page, $size, $sort, $search_filter, $since, $before): \MailSlurp\Models\PageWebhookProjection +``` + +Get paginated webhooks for an Inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getInboxWebhooksPaginated($inbox_id, $page, $size, $sort, $search_filter, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getInboxWebhooksPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookProjection**](../Model/PageWebhookProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getJsonSchemaForWebhookEvent()` + +```php +getJsonSchemaForWebhookEvent($event): \MailSlurp\Models\JSONSchemaDto +``` + + + +Get JSON Schema definition for webhook payload by event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$event = 'event_example'; // string + +try { + $result = $apiInstance->getJsonSchemaForWebhookEvent($event); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getJsonSchemaForWebhookEvent: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **event** | **string**| | | + +### Return type + +[**\MailSlurp\Models\JSONSchemaDto**](../Model/JSONSchemaDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getJsonSchemaForWebhookPayload()` + +```php +getJsonSchemaForWebhookPayload($webhook_id): \MailSlurp\Models\JSONSchemaDto +``` + + + +Get JSON Schema definition for webhook payload + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string + +try { + $result = $apiInstance->getJsonSchemaForWebhookPayload($webhook_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getJsonSchemaForWebhookPayload: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\JSONSchemaDto**](../Model/JSONSchemaDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getPhoneNumberWebhooksPaginated()` + +```php +getPhoneNumberWebhooksPaginated($phone_id, $page, $size, $sort, $since, $before): \MailSlurp\Models\PageWebhookProjection +``` + +Get paginated webhooks for a phone number + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone_id = 'phone_id_example'; // string +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp + +try { + $result = $apiInstance->getPhoneNumberWebhooksPaginated($phone_id, $page, $size, $sort, $since, $before); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getPhoneNumberWebhooksPaginated: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone_id** | **string**| | | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookProjection**](../Model/PageWebhookProjection) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayload()` + +```php +getTestWebhookPayload($event_name): \MailSlurp\Models\AbstractWebhookPayload +``` + + + +Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$event_name = 'event_name_example'; // string + +try { + $result = $apiInstance->getTestWebhookPayload($event_name); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayload: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **event_name** | **string**| | [optional] | + +### Return type + +[**\MailSlurp\Models\AbstractWebhookPayload**](../Model/AbstractWebhookPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadBounce()` + +```php +getTestWebhookPayloadBounce(): \MailSlurp\Models\WebhookBouncePayload +``` + + + +Get webhook test payload for bounce + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadBounce(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadBounce: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookBouncePayload**](../Model/WebhookBouncePayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadBounceRecipient()` + +```php +getTestWebhookPayloadBounceRecipient(): \MailSlurp\Models\WebhookBounceRecipientPayload +``` + + + +Get webhook test payload for bounce recipient + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadBounceRecipient(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadBounceRecipient: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookBounceRecipientPayload**](../Model/WebhookBounceRecipientPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadDeliveryStatus()` + +```php +getTestWebhookPayloadDeliveryStatus(): \MailSlurp\Models\WebhookDeliveryStatusPayload +``` + +Get webhook test payload for delivery status event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadDeliveryStatus(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadDeliveryStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookDeliveryStatusPayload**](../Model/WebhookDeliveryStatusPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadEmailOpened()` + +```php +getTestWebhookPayloadEmailOpened(): \MailSlurp\Models\WebhookEmailOpenedPayload +``` + + + +Get webhook test payload for email opened event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadEmailOpened(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadEmailOpened: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookEmailOpenedPayload**](../Model/WebhookEmailOpenedPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadEmailRead()` + +```php +getTestWebhookPayloadEmailRead(): \MailSlurp\Models\WebhookEmailReadPayload +``` + + + +Get webhook test payload for email opened event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadEmailRead(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadEmailRead: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookEmailReadPayload**](../Model/WebhookEmailReadPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadForWebhook()` + +```php +getTestWebhookPayloadForWebhook($webhook_id): \MailSlurp\Models\AbstractWebhookPayload +``` + + + +Get example payload for webhook + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string + +try { + $result = $apiInstance->getTestWebhookPayloadForWebhook($webhook_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadForWebhook: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\AbstractWebhookPayload**](../Model/AbstractWebhookPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadNewAttachment()` + +```php +getTestWebhookPayloadNewAttachment(): \MailSlurp\Models\WebhookNewAttachmentPayload +``` + +Get webhook test payload for new attachment event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadNewAttachment(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadNewAttachment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookNewAttachmentPayload**](../Model/WebhookNewAttachmentPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadNewContact()` + +```php +getTestWebhookPayloadNewContact(): \MailSlurp\Models\WebhookNewContactPayload +``` + +Get webhook test payload for new contact event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadNewContact(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadNewContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookNewContactPayload**](../Model/WebhookNewContactPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadNewEmail()` + +```php +getTestWebhookPayloadNewEmail(): \MailSlurp\Models\WebhookNewEmailPayload +``` + +Get webhook test payload for new email event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadNewEmail(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadNewEmail: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookNewEmailPayload**](../Model/WebhookNewEmailPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getTestWebhookPayloadNewSms()` + +```php +getTestWebhookPayloadNewSms(): \MailSlurp\Models\WebhookNewSmsPayload +``` + +Get webhook test payload for new sms event + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getTestWebhookPayloadNewSms(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getTestWebhookPayloadNewSms: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\WebhookNewSmsPayload**](../Model/WebhookNewSmsPayload) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getWebhook()` + +```php +getWebhook($webhook_id): \MailSlurp\Models\WebhookDto +``` + +Get a webhook + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string + +try { + $result = $apiInstance->getWebhook($webhook_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getWebhook: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getWebhookResult()` + +```php +getWebhookResult($webhook_result_id): \MailSlurp\Models\WebhookResultDto +``` + +Get a webhook result for a webhook + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_result_id = 'webhook_result_id_example'; // string | Webhook Result ID + +try { + $result = $apiInstance->getWebhookResult($webhook_result_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getWebhookResult: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_result_id** | **string**| Webhook Result ID | | + +### Return type + +[**\MailSlurp\Models\WebhookResultDto**](../Model/WebhookResultDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getWebhookResults()` + +```php +getWebhookResults($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only): \MailSlurp\Models\PageWebhookResult +``` + +Get a webhook results for a webhook + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string | ID of webhook to get results for +$page = 0; // int | Optional page index in list pagination +$size = 20; // int | Optional page size in list pagination +$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC +$search_filter = 'search_filter_example'; // string | Optional search filter +$since = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at after the given timestamp +$before = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter by created at before the given timestamp +$unseen_only = True; // bool | Filter for unseen exceptions only + +try { + $result = $apiInstance->getWebhookResults($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getWebhookResults: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| ID of webhook to get results for | | +| **page** | **int**| Optional page index in list pagination | [optional] [default to 0] | +| **size** | **int**| Optional page size in list pagination | [optional] [default to 20] | +| **sort** | **string**| Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] | +| **search_filter** | **string**| Optional search filter | [optional] | +| **since** | **\DateTime**| Filter by created at after the given timestamp | [optional] | +| **before** | **\DateTime**| Filter by created at before the given timestamp | [optional] | +| **unseen_only** | **bool**| Filter for unseen exceptions only | [optional] | + +### Return type + +[**\MailSlurp\Models\PageWebhookResult**](../Model/PageWebhookResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getWebhookResultsUnseenErrorCount()` + +```php +getWebhookResultsUnseenErrorCount(): \MailSlurp\Models\UnseenErrorCountDto +``` + +Get count of unseen webhook results with error status + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->getWebhookResultsUnseenErrorCount(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getWebhookResultsUnseenErrorCount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\MailSlurp\Models\UnseenErrorCountDto**](../Model/UnseenErrorCountDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `getWebhooks()` + +```php +getWebhooks($inbox_id): \MailSlurp\Models\WebhookDto[] +``` + +Get all webhooks for an Inbox + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$inbox_id = 'inbox_id_example'; // string + +try { + $result = $apiInstance->getWebhooks($inbox_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->getWebhooks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **inbox_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto[]**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `redriveWebhookResult()` + +```php +redriveWebhookResult($webhook_result_id): \MailSlurp\Models\WebhookRedriveResult +``` + +Get a webhook result and try to resend the original webhook payload + +Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_result_id = 'webhook_result_id_example'; // string | Webhook Result ID + +try { + $result = $apiInstance->redriveWebhookResult($webhook_result_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->redriveWebhookResult: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_result_id** | **string**| Webhook Result ID | | + +### Return type + +[**\MailSlurp\Models\WebhookRedriveResult**](../Model/WebhookRedriveResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `sendTestData()` + +```php +sendTestData($webhook_id): \MailSlurp\Models\WebhookTestResult +``` + +Send webhook test data + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string + +try { + $result = $apiInstance->sendTestData($webhook_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->sendTestData: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | + +### Return type + +[**\MailSlurp\Models\WebhookTestResult**](../Model/WebhookTestResult) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `updateWebhookHeaders()` + +```php +updateWebhookHeaders($webhook_id, $webhook_headers): \MailSlurp\Models\WebhookDto +``` + +Update a webhook request headers + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$webhook_id = 'webhook_id_example'; // string +$webhook_headers = new \MailSlurp\Models\WebhookHeaders(); // \MailSlurp\Models\WebhookHeaders + +try { + $result = $apiInstance->updateWebhookHeaders($webhook_id, $webhook_headers); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->updateWebhookHeaders: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **webhook_id** | **string**| | | +| **webhook_headers** | [**\MailSlurp\Models\WebhookHeaders**](../Model/WebhookHeaders)| | | + +### Return type + +[**\MailSlurp\Models\WebhookDto**](../Model/WebhookDto) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) + +## `verifyWebhookSignature()` + +```php +verifyWebhookSignature($verify_webhook_signature_options): \MailSlurp\Models\VerifyWebhookSignatureResults +``` + +Verify a webhook payload signature + +Verify a webhook payload using the messageId and signature. This allows you to be sure that MailSlurp sent the payload and not another server. + +### Example + +```php +setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + + +$apiInstance = new MailSlurp\Api\WebhookControllerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$verify_webhook_signature_options = new \MailSlurp\Models\VerifyWebhookSignatureOptions(); // \MailSlurp\Models\VerifyWebhookSignatureOptions + +try { + $result = $apiInstance->verifyWebhookSignature($verify_webhook_signature_options); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WebhookControllerApi->verifyWebhookSignature: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **verify_webhook_signature_options** | [**\MailSlurp\Models\VerifyWebhookSignatureOptions**](../Model/VerifyWebhookSignatureOptions)| | | + +### Return type + +[**\MailSlurp\Models\VerifyWebhookSignatureResults**](../Model/VerifyWebhookSignatureResults) + +### Authorization + +[API_KEY](../../README#API_KEY) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README#endpoints) +[[Back to Model list]](../../README#models) +[[Back to README]](../../README) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 00000000..1271001d --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Apis/AliasControllerApi.php b/lib/Apis/AliasControllerApi.php new file mode 100644 index 00000000..93392d8c --- /dev/null +++ b/lib/Apis/AliasControllerApi.php @@ -0,0 +1,2987 @@ + [ + 'application/json', + ], + 'deleteAlias' => [ + 'application/json', + ], + 'getAlias' => [ + 'application/json', + ], + 'getAliasEmails' => [ + 'application/json', + ], + 'getAliasThreads' => [ + 'application/json', + ], + 'getAliases' => [ + 'application/json', + ], + 'replyToAliasEmail' => [ + 'application/json', + ], + 'sendAliasEmail' => [ + 'application/json', + ], + 'updateAlias' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createAlias + * + * Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. + * + * @param \MailSlurp\Models\CreateAliasOptions $create_alias_options create_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AliasDto + */ + public function createAlias($create_alias_options, string $contentType = self::contentTypes['createAlias'][0]) + { + list($response) = $this->createAliasWithHttpInfo($create_alias_options, $contentType); + return $response; + } + + /** + * Operation createAliasWithHttpInfo + * + * Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. + * + * @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createAliasWithHttpInfo($create_alias_options, string $contentType = self::contentTypes['createAlias'][0]) + { + $request = $this->createAliasRequest($create_alias_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AliasDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AliasDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AliasDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAliasAsync + * + * Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. + * + * @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAliasAsync($create_alias_options, string $contentType = self::contentTypes['createAlias'][0]) + { + return $this->createAliasAsyncWithHttpInfo($create_alias_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAliasAsyncWithHttpInfo + * + * Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active. + * + * @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAliasAsyncWithHttpInfo($create_alias_options, string $contentType = self::contentTypes['createAlias'][0]) + { + $returnType = '\MailSlurp\Models\AliasDto'; + $request = $this->createAliasRequest($create_alias_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createAlias' + * + * @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createAliasRequest($create_alias_options, string $contentType = self::contentTypes['createAlias'][0]) + { + + // verify the required parameter 'create_alias_options' is set + if ($create_alias_options === null || (is_array($create_alias_options) && count($create_alias_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_alias_options when calling createAlias' + ); + } + + + $resourcePath = '/aliases'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_alias_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_alias_options)); + } else { + $httpBody = $create_alias_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAlias + * + * Delete an email alias + * + * @param string $alias_id alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAlias($alias_id, string $contentType = self::contentTypes['deleteAlias'][0]) + { + $this->deleteAliasWithHttpInfo($alias_id, $contentType); + } + + /** + * Operation deleteAliasWithHttpInfo + * + * Delete an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAliasWithHttpInfo($alias_id, string $contentType = self::contentTypes['deleteAlias'][0]) + { + $request = $this->deleteAliasRequest($alias_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAliasAsync + * + * Delete an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAliasAsync($alias_id, string $contentType = self::contentTypes['deleteAlias'][0]) + { + return $this->deleteAliasAsyncWithHttpInfo($alias_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAliasAsyncWithHttpInfo + * + * Delete an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAliasAsyncWithHttpInfo($alias_id, string $contentType = self::contentTypes['deleteAlias'][0]) + { + $returnType = ''; + $request = $this->deleteAliasRequest($alias_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAlias' + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAliasRequest($alias_id, string $contentType = self::contentTypes['deleteAlias'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling deleteAlias' + ); + } + + + $resourcePath = '/aliases/{aliasId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAlias + * + * Get an email alias + * + * @param string $alias_id alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AliasDto + */ + public function getAlias($alias_id, string $contentType = self::contentTypes['getAlias'][0]) + { + list($response) = $this->getAliasWithHttpInfo($alias_id, $contentType); + return $response; + } + + /** + * Operation getAliasWithHttpInfo + * + * Get an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getAliasWithHttpInfo($alias_id, string $contentType = self::contentTypes['getAlias'][0]) + { + $request = $this->getAliasRequest($alias_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AliasDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AliasDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AliasDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAliasAsync + * + * Get an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasAsync($alias_id, string $contentType = self::contentTypes['getAlias'][0]) + { + return $this->getAliasAsyncWithHttpInfo($alias_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAliasAsyncWithHttpInfo + * + * Get an email alias + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasAsyncWithHttpInfo($alias_id, string $contentType = self::contentTypes['getAlias'][0]) + { + $returnType = '\MailSlurp\Models\AliasDto'; + $request = $this->getAliasRequest($alias_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAlias' + * + * @param string $alias_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAliasRequest($alias_id, string $contentType = self::contentTypes['getAlias'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling getAlias' + ); + } + + + $resourcePath = '/aliases/{aliasId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAliasEmails + * + * Get emails for an alias + * + * @param string $alias_id alias_id (required) + * @param int $page Optional page index alias email list pagination (optional, default to 0) + * @param int $size Optional page size alias email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageEmailProjection + */ + public function getAliasEmails($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0]) + { + list($response) = $this->getAliasEmailsWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAliasEmailsWithHttpInfo + * + * Get emails for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index alias email list pagination (optional, default to 0) + * @param int $size Optional page size alias email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAliasEmailsWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0]) + { + $request = $this->getAliasEmailsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAliasEmailsAsync + * + * Get emails for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index alias email list pagination (optional, default to 0) + * @param int $size Optional page size alias email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasEmailsAsync($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0]) + { + return $this->getAliasEmailsAsyncWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAliasEmailsAsyncWithHttpInfo + * + * Get emails for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index alias email list pagination (optional, default to 0) + * @param int $size Optional page size alias email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasEmailsAsyncWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageEmailProjection'; + $request = $this->getAliasEmailsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAliasEmails' + * + * @param string $alias_id (required) + * @param int $page Optional page index alias email list pagination (optional, default to 0) + * @param int $size Optional page size alias email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAliasEmailsRequest($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling getAliasEmails' + ); + } + + + + + + + + $resourcePath = '/aliases/{aliasId}/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAliasThreads + * + * Get threads created for an alias + * + * @param string $alias_id alias_id (required) + * @param int $page Optional page index in thread list pagination (optional, default to 0) + * @param int $size Optional page size in thread list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageThreadProjection + */ + public function getAliasThreads($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0]) + { + list($response) = $this->getAliasThreadsWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAliasThreadsWithHttpInfo + * + * Get threads created for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index in thread list pagination (optional, default to 0) + * @param int $size Optional page size in thread list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageThreadProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAliasThreadsWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0]) + { + $request = $this->getAliasThreadsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageThreadProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageThreadProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageThreadProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageThreadProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageThreadProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAliasThreadsAsync + * + * Get threads created for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index in thread list pagination (optional, default to 0) + * @param int $size Optional page size in thread list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasThreadsAsync($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0]) + { + return $this->getAliasThreadsAsyncWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAliasThreadsAsyncWithHttpInfo + * + * Get threads created for an alias + * + * @param string $alias_id (required) + * @param int $page Optional page index in thread list pagination (optional, default to 0) + * @param int $size Optional page size in thread list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasThreadsAsyncWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0]) + { + $returnType = '\MailSlurp\Models\PageThreadProjection'; + $request = $this->getAliasThreadsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAliasThreads' + * + * @param string $alias_id (required) + * @param int $page Optional page index in thread list pagination (optional, default to 0) + * @param int $size Optional page size in thread list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAliasThreadsRequest($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling getAliasThreads' + ); + } + + + + + + + + $resourcePath = '/aliases/{aliasId}/threads'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAliases + * + * Get all email aliases you have created + * + * @param int $page Optional page index in alias list pagination (optional, default to 0) + * @param int $size Optional page size in alias list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageAlias + */ + public function getAliases($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0]) + { + list($response) = $this->getAliasesWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAliasesWithHttpInfo + * + * Get all email aliases you have created + * + * @param int $page Optional page index in alias list pagination (optional, default to 0) + * @param int $size Optional page size in alias list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageAlias, HTTP status code, HTTP response headers (array of strings) + */ + public function getAliasesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0]) + { + $request = $this->getAliasesRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageAlias' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageAlias' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageAlias', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageAlias'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageAlias', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAliasesAsync + * + * Get all email aliases you have created + * + * @param int $page Optional page index in alias list pagination (optional, default to 0) + * @param int $size Optional page size in alias list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0]) + { + return $this->getAliasesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAliasesAsyncWithHttpInfo + * + * Get all email aliases you have created + * + * @param int $page Optional page index in alias list pagination (optional, default to 0) + * @param int $size Optional page size in alias list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAliasesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0]) + { + $returnType = '\MailSlurp\Models\PageAlias'; + $request = $this->getAliasesRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAliases' + * + * @param int $page Optional page index in alias list pagination (optional, default to 0) + * @param int $size Optional page size in alias list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAliasesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0]) + { + + + + + + + + $resourcePath = '/aliases'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation replyToAliasEmail + * + * Reply to an email + * + * @param string $alias_id ID of the alias that email belongs to (required) + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options reply_to_alias_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0]) + { + list($response) = $this->replyToAliasEmailWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, $contentType); + return $response; + } + + /** + * Operation replyToAliasEmailWithHttpInfo + * + * Reply to an email + * + * @param string $alias_id ID of the alias that email belongs to (required) + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function replyToAliasEmailWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0]) + { + $request = $this->replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation replyToAliasEmailAsync + * + * Reply to an email + * + * @param string $alias_id ID of the alias that email belongs to (required) + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replyToAliasEmailAsync($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0]) + { + return $this->replyToAliasEmailAsyncWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation replyToAliasEmailAsyncWithHttpInfo + * + * Reply to an email + * + * @param string $alias_id ID of the alias that email belongs to (required) + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replyToAliasEmailAsyncWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'replyToAliasEmail' + * + * @param string $alias_id ID of the alias that email belongs to (required) + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling replyToAliasEmail' + ); + } + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling replyToAliasEmail' + ); + } + + // verify the required parameter 'reply_to_alias_email_options' is set + if ($reply_to_alias_email_options === null || (is_array($reply_to_alias_email_options) && count($reply_to_alias_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $reply_to_alias_email_options when calling replyToAliasEmail' + ); + } + + + $resourcePath = '/aliases/{aliasId}/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($reply_to_alias_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($reply_to_alias_email_options)); + } else { + $httpBody = $reply_to_alias_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendAliasEmail + * + * Send an email from an alias inbox + * + * @param string $alias_id alias_id (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function sendAliasEmail($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0]) + { + list($response) = $this->sendAliasEmailWithHttpInfo($alias_id, $send_email_options, $contentType); + return $response; + } + + /** + * Operation sendAliasEmailWithHttpInfo + * + * Send an email from an alias inbox + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function sendAliasEmailWithHttpInfo($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0]) + { + $request = $this->sendAliasEmailRequest($alias_id, $send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendAliasEmailAsync + * + * Send an email from an alias inbox + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendAliasEmailAsync($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0]) + { + return $this->sendAliasEmailAsyncWithHttpInfo($alias_id, $send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendAliasEmailAsyncWithHttpInfo + * + * Send an email from an alias inbox + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendAliasEmailAsyncWithHttpInfo($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->sendAliasEmailRequest($alias_id, $send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendAliasEmail' + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendAliasEmailRequest($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling sendAliasEmail' + ); + } + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendAliasEmail' + ); + } + + + $resourcePath = '/aliases/{aliasId}/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateAlias + * + * Update an email alias + * + * @param string $alias_id alias_id (required) + * @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options update_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AliasDto + */ + public function updateAlias($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0]) + { + list($response) = $this->updateAliasWithHttpInfo($alias_id, $update_alias_options, $contentType); + return $response; + } + + /** + * Operation updateAliasWithHttpInfo + * + * Update an email alias + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateAliasWithHttpInfo($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0]) + { + $request = $this->updateAliasRequest($alias_id, $update_alias_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 202: + if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AliasDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AliasDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AliasDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAliasAsync + * + * Update an email alias + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAliasAsync($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0]) + { + return $this->updateAliasAsyncWithHttpInfo($alias_id, $update_alias_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAliasAsyncWithHttpInfo + * + * Update an email alias + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAliasAsyncWithHttpInfo($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0]) + { + $returnType = '\MailSlurp\Models\AliasDto'; + $request = $this->updateAliasRequest($alias_id, $update_alias_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateAlias' + * + * @param string $alias_id (required) + * @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateAliasRequest($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0]) + { + + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling updateAlias' + ); + } + + // verify the required parameter 'update_alias_options' is set + if ($update_alias_options === null || (is_array($update_alias_options) && count($update_alias_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_alias_options when calling updateAlias' + ); + } + + + $resourcePath = '/aliases/{aliasId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'aliasId' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_alias_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_alias_options)); + } else { + $httpBody = $update_alias_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/ApiUserControllerApi.php b/lib/Apis/ApiUserControllerApi.php new file mode 100644 index 00000000..b3994b73 --- /dev/null +++ b/lib/Apis/ApiUserControllerApi.php @@ -0,0 +1,707 @@ + [ + 'application/json', + ], + 'getUserInfo' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getJsonPropertyAsString + * + * @param string $property JSON property name or dot separated path selector such as `a.b.c` (required) + * @param object $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getJsonPropertyAsString($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0]) + { + list($response) = $this->getJsonPropertyAsStringWithHttpInfo($property, $body, $contentType); + return $response; + } + + /** + * Operation getJsonPropertyAsStringWithHttpInfo + * + * @param string $property JSON property name or dot separated path selector such as `a.b.c` (required) + * @param object $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getJsonPropertyAsStringWithHttpInfo($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0]) + { + $request = $this->getJsonPropertyAsStringRequest($property, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getJsonPropertyAsStringAsync + * + * @param string $property JSON property name or dot separated path selector such as `a.b.c` (required) + * @param object $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonPropertyAsStringAsync($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0]) + { + return $this->getJsonPropertyAsStringAsyncWithHttpInfo($property, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getJsonPropertyAsStringAsyncWithHttpInfo + * + * @param string $property JSON property name or dot separated path selector such as `a.b.c` (required) + * @param object $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonPropertyAsStringAsyncWithHttpInfo($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0]) + { + $returnType = 'string'; + $request = $this->getJsonPropertyAsStringRequest($property, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getJsonPropertyAsString' + * + * @param string $property JSON property name or dot separated path selector such as `a.b.c` (required) + * @param object $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getJsonPropertyAsStringRequest($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0]) + { + + // verify the required parameter 'property' is set + if ($property === null || (is_array($property) && count($property) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $property when calling getJsonPropertyAsString' + ); + } + + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling getJsonPropertyAsString' + ); + } + + + $resourcePath = '/user/json/pluck'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $property, + 'property', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUserInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\UserInfoDto + */ + public function getUserInfo(string $contentType = self::contentTypes['getUserInfo'][0]) + { + list($response) = $this->getUserInfoWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getUserInfoWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\UserInfoDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getUserInfoWithHttpInfo(string $contentType = self::contentTypes['getUserInfo'][0]) + { + $request = $this->getUserInfoRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\UserInfoDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\UserInfoDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\UserInfoDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\UserInfoDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\UserInfoDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getUserInfoAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserInfoAsync(string $contentType = self::contentTypes['getUserInfo'][0]) + { + return $this->getUserInfoAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserInfoAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserInfoAsyncWithHttpInfo(string $contentType = self::contentTypes['getUserInfo'][0]) + { + $returnType = '\MailSlurp\Models\UserInfoDto'; + $request = $this->getUserInfoRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUserInfo' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserInfoRequest(string $contentType = self::contentTypes['getUserInfo'][0]) + { + + + $resourcePath = '/user/info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/AttachmentControllerApi.php b/lib/Apis/AttachmentControllerApi.php new file mode 100644 index 00000000..abd42abd --- /dev/null +++ b/lib/Apis/AttachmentControllerApi.php @@ -0,0 +1,3054 @@ + [ + 'application/json', + ], + 'deleteAttachment' => [ + 'application/json', + ], + 'downloadAttachmentAsBase64Encoded' => [ + 'application/json', + ], + 'downloadAttachmentAsBytes' => [ + 'application/json', + ], + 'getAttachment' => [ + 'application/json', + ], + 'getAttachmentInfo' => [ + 'application/json', + ], + 'getAttachments' => [ + 'application/json', + ], + 'uploadAttachment' => [ + 'application/json', + ], + 'uploadAttachmentBytes' => [ + 'application/octet-stream', + ], + 'uploadMultipartForm' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation deleteAllAttachments + * + * Delete all attachments + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllAttachments(string $contentType = self::contentTypes['deleteAllAttachments'][0]) + { + $this->deleteAllAttachmentsWithHttpInfo($contentType); + } + + /** + * Operation deleteAllAttachmentsWithHttpInfo + * + * Delete all attachments + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllAttachmentsWithHttpInfo(string $contentType = self::contentTypes['deleteAllAttachments'][0]) + { + $request = $this->deleteAllAttachmentsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllAttachmentsAsync + * + * Delete all attachments + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllAttachmentsAsync(string $contentType = self::contentTypes['deleteAllAttachments'][0]) + { + return $this->deleteAllAttachmentsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllAttachmentsAsyncWithHttpInfo + * + * Delete all attachments + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllAttachmentsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllAttachments'][0]) + { + $returnType = ''; + $request = $this->deleteAllAttachmentsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllAttachments' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllAttachmentsRequest(string $contentType = self::contentTypes['deleteAllAttachments'][0]) + { + + + $resourcePath = '/attachments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAttachment + * + * Delete an attachment + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAttachment($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0]) + { + $this->deleteAttachmentWithHttpInfo($attachment_id, $contentType); + } + + /** + * Operation deleteAttachmentWithHttpInfo + * + * Delete an attachment + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAttachmentWithHttpInfo($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0]) + { + $request = $this->deleteAttachmentRequest($attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAttachmentAsync + * + * Delete an attachment + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAttachmentAsync($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0]) + { + return $this->deleteAttachmentAsyncWithHttpInfo($attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAttachmentAsyncWithHttpInfo + * + * Delete an attachment + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAttachmentAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0]) + { + $returnType = ''; + $request = $this->deleteAttachmentRequest($attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAttachment' + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAttachmentRequest($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0]) + { + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling deleteAttachment' + ); + } + + + $resourcePath = '/attachments/{attachmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadAttachmentAsBase64Encoded + * + * Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DownloadAttachmentDto + */ + public function downloadAttachmentAsBase64Encoded($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0]) + { + list($response) = $this->downloadAttachmentAsBase64EncodedWithHttpInfo($attachment_id, $contentType); + return $response; + } + + /** + * Operation downloadAttachmentAsBase64EncodedWithHttpInfo + * + * Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DownloadAttachmentDto, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadAttachmentAsBase64EncodedWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0]) + { + $request = $this->downloadAttachmentAsBase64EncodedRequest($attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DownloadAttachmentDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DownloadAttachmentDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DownloadAttachmentDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DownloadAttachmentDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DownloadAttachmentDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadAttachmentAsBase64EncodedAsync + * + * Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsBase64EncodedAsync($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0]) + { + return $this->downloadAttachmentAsBase64EncodedAsyncWithHttpInfo($attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadAttachmentAsBase64EncodedAsyncWithHttpInfo + * + * Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsBase64EncodedAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0]) + { + $returnType = '\MailSlurp\Models\DownloadAttachmentDto'; + $request = $this->downloadAttachmentAsBase64EncodedRequest($attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadAttachmentAsBase64Encoded' + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadAttachmentAsBase64EncodedRequest($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0]) + { + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling downloadAttachmentAsBase64Encoded' + ); + } + + + $resourcePath = '/attachments/{attachmentId}/base64'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadAttachmentAsBytes + * + * Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function downloadAttachmentAsBytes($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0]) + { + list($response) = $this->downloadAttachmentAsBytesWithHttpInfo($attachment_id, $contentType); + return $response; + } + + /** + * Operation downloadAttachmentAsBytesWithHttpInfo + * + * Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadAttachmentAsBytesWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0]) + { + $request = $this->downloadAttachmentAsBytesRequest($attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + default: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadAttachmentAsBytesAsync + * + * Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsBytesAsync($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0]) + { + return $this->downloadAttachmentAsBytesAsyncWithHttpInfo($attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadAttachmentAsBytesAsyncWithHttpInfo + * + * Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsBytesAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0]) + { + $returnType = 'string'; + $request = $this->downloadAttachmentAsBytesRequest($attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadAttachmentAsBytes' + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadAttachmentAsBytesRequest($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0]) + { + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling downloadAttachmentAsBytes' + ); + } + + + $resourcePath = '/attachments/{attachmentId}/bytes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAttachment + * + * Get an attachment entity + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AttachmentEntity + */ + public function getAttachment($attachment_id, string $contentType = self::contentTypes['getAttachment'][0]) + { + list($response) = $this->getAttachmentWithHttpInfo($attachment_id, $contentType); + return $response; + } + + /** + * Operation getAttachmentWithHttpInfo + * + * Get an attachment entity + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AttachmentEntity, HTTP status code, HTTP response headers (array of strings) + */ + public function getAttachmentWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachment'][0]) + { + $request = $this->getAttachmentRequest($attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AttachmentEntity' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AttachmentEntity' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentEntity', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AttachmentEntity'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AttachmentEntity', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttachmentAsync + * + * Get an attachment entity + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentAsync($attachment_id, string $contentType = self::contentTypes['getAttachment'][0]) + { + return $this->getAttachmentAsyncWithHttpInfo($attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttachmentAsyncWithHttpInfo + * + * Get an attachment entity + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachment'][0]) + { + $returnType = '\MailSlurp\Models\AttachmentEntity'; + $request = $this->getAttachmentRequest($attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAttachment' + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAttachmentRequest($attachment_id, string $contentType = self::contentTypes['getAttachment'][0]) + { + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling getAttachment' + ); + } + + + $resourcePath = '/attachments/{attachmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAttachmentInfo + * + * Get email attachment metadata information + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AttachmentMetaData + */ + public function getAttachmentInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0]) + { + list($response) = $this->getAttachmentInfoWithHttpInfo($attachment_id, $contentType); + return $response; + } + + /** + * Operation getAttachmentInfoWithHttpInfo + * + * Get email attachment metadata information + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AttachmentMetaData, HTTP status code, HTTP response headers (array of strings) + */ + public function getAttachmentInfoWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0]) + { + $request = $this->getAttachmentInfoRequest($attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AttachmentMetaData' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AttachmentMetaData' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AttachmentMetaData'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AttachmentMetaData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttachmentInfoAsync + * + * Get email attachment metadata information + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentInfoAsync($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0]) + { + return $this->getAttachmentInfoAsyncWithHttpInfo($attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttachmentInfoAsyncWithHttpInfo + * + * Get email attachment metadata information + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentInfoAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0]) + { + $returnType = '\MailSlurp\Models\AttachmentMetaData'; + $request = $this->getAttachmentInfoRequest($attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAttachmentInfo' + * + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAttachmentInfoRequest($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0]) + { + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling getAttachmentInfo' + ); + } + + + $resourcePath = '/attachments/{attachmentId}/metadata'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAttachments + * + * Get email attachments + * + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $file_name_filter Optional file name and content type search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageAttachmentEntity + */ + public function getAttachments($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAttachments'][0]) + { + list($response) = $this->getAttachmentsWithHttpInfo($page, $size, $sort, $file_name_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAttachmentsWithHttpInfo + * + * Get email attachments + * + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $file_name_filter Optional file name and content type search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageAttachmentEntity, HTTP status code, HTTP response headers (array of strings) + */ + public function getAttachmentsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAttachments'][0]) + { + $request = $this->getAttachmentsRequest($page, $size, $sort, $file_name_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageAttachmentEntity' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageAttachmentEntity' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageAttachmentEntity', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageAttachmentEntity'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageAttachmentEntity', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttachmentsAsync + * + * Get email attachments + * + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $file_name_filter Optional file name and content type search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentsAsync($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAttachments'][0]) + { + return $this->getAttachmentsAsyncWithHttpInfo($page, $size, $sort, $file_name_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttachmentsAsyncWithHttpInfo + * + * Get email attachments + * + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $file_name_filter Optional file name and content type search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAttachments'][0]) + { + $returnType = '\MailSlurp\Models\PageAttachmentEntity'; + $request = $this->getAttachmentsRequest($page, $size, $sort, $file_name_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAttachments' + * + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $file_name_filter Optional file name and content type search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAttachmentsRequest($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAttachments'][0]) + { + + + + + + + + + $resourcePath = '/attachments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_name_filter, + 'fileNameFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation uploadAttachment + * + * Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options upload_attachment_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function uploadAttachment($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0]) + { + list($response) = $this->uploadAttachmentWithHttpInfo($upload_attachment_options, $contentType); + return $response; + } + + /** + * Operation uploadAttachmentWithHttpInfo + * + * Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function uploadAttachmentWithHttpInfo($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0]) + { + $request = $this->uploadAttachmentRequest($upload_attachment_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation uploadAttachmentAsync + * + * Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadAttachmentAsync($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0]) + { + return $this->uploadAttachmentAsyncWithHttpInfo($upload_attachment_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadAttachmentAsyncWithHttpInfo + * + * Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadAttachmentAsyncWithHttpInfo($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0]) + { + $returnType = 'string[]'; + $request = $this->uploadAttachmentRequest($upload_attachment_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'uploadAttachment' + * + * @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function uploadAttachmentRequest($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0]) + { + + // verify the required parameter 'upload_attachment_options' is set + if ($upload_attachment_options === null || (is_array($upload_attachment_options) && count($upload_attachment_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $upload_attachment_options when calling uploadAttachment' + ); + } + + + $resourcePath = '/attachments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($upload_attachment_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($upload_attachment_options)); + } else { + $httpBody = $upload_attachment_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation uploadAttachmentBytes + * + * Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentBytesRequest $upload_attachment_bytes_request upload_attachment_bytes_request (required) + * @param string $content_type Optional contentType for file. For instance `application/pdf` (optional) + * @param string $filename Optional filename to save upload with (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function uploadAttachmentBytes($upload_attachment_bytes_request, $content_type = null, $filename = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0]) + { + list($response) = $this->uploadAttachmentBytesWithHttpInfo($upload_attachment_bytes_request, $content_type, $filename, $contentType); + return $response; + } + + /** + * Operation uploadAttachmentBytesWithHttpInfo + * + * Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentBytesRequest $upload_attachment_bytes_request (required) + * @param string $content_type Optional contentType for file. For instance `application/pdf` (optional) + * @param string $filename Optional filename to save upload with (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function uploadAttachmentBytesWithHttpInfo($upload_attachment_bytes_request, $content_type = null, $filename = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0]) + { + $request = $this->uploadAttachmentBytesRequest($upload_attachment_bytes_request, $content_type, $filename, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation uploadAttachmentBytesAsync + * + * Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentBytesRequest $upload_attachment_bytes_request (required) + * @param string $content_type Optional contentType for file. For instance `application/pdf` (optional) + * @param string $filename Optional filename to save upload with (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadAttachmentBytesAsync($upload_attachment_bytes_request, $content_type = null, $filename = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0]) + { + return $this->uploadAttachmentBytesAsyncWithHttpInfo($upload_attachment_bytes_request, $content_type, $filename, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadAttachmentBytesAsyncWithHttpInfo + * + * Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param \MailSlurp\Models\UploadAttachmentBytesRequest $upload_attachment_bytes_request (required) + * @param string $content_type Optional contentType for file. For instance `application/pdf` (optional) + * @param string $filename Optional filename to save upload with (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadAttachmentBytesAsyncWithHttpInfo($upload_attachment_bytes_request, $content_type = null, $filename = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0]) + { + $returnType = 'string[]'; + $request = $this->uploadAttachmentBytesRequest($upload_attachment_bytes_request, $content_type, $filename, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'uploadAttachmentBytes' + * + * @param \MailSlurp\Models\UploadAttachmentBytesRequest $upload_attachment_bytes_request (required) + * @param string $content_type Optional contentType for file. For instance `application/pdf` (optional) + * @param string $filename Optional filename to save upload with (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function uploadAttachmentBytesRequest($upload_attachment_bytes_request, $content_type = null, $filename = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0]) + { + + // verify the required parameter 'upload_attachment_bytes_request' is set + if ($upload_attachment_bytes_request === null || (is_array($upload_attachment_bytes_request) && count($upload_attachment_bytes_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $upload_attachment_bytes_request when calling uploadAttachmentBytes' + ); + } + + + + + $resourcePath = '/attachments/bytes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filename, + 'filename', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header params + if ($content_type !== null) { + $headerParams['contentType'] = ObjectSerializer::toHeaderValue($content_type); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($upload_attachment_bytes_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($upload_attachment_bytes_request)); + } else { + $httpBody = $upload_attachment_bytes_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation uploadMultipartForm + * + * Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param string $content_type Optional content type of attachment (optional) + * @param string $filename Optional name of file (optional) + * @param string $x_filename Optional content type header of attachment (optional) + * @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request upload_multipart_form_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function uploadMultipartForm($content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0]) + { + list($response) = $this->uploadMultipartFormWithHttpInfo($content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType); + return $response; + } + + /** + * Operation uploadMultipartFormWithHttpInfo + * + * Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param string $content_type Optional content type of attachment (optional) + * @param string $filename Optional name of file (optional) + * @param string $x_filename Optional content type header of attachment (optional) + * @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function uploadMultipartFormWithHttpInfo($content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0]) + { + $request = $this->uploadMultipartFormRequest($content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation uploadMultipartFormAsync + * + * Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param string $content_type Optional content type of attachment (optional) + * @param string $filename Optional name of file (optional) + * @param string $x_filename Optional content type header of attachment (optional) + * @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadMultipartFormAsync($content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0]) + { + return $this->uploadMultipartFormAsyncWithHttpInfo($content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadMultipartFormAsyncWithHttpInfo + * + * Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. + * + * @param string $content_type Optional content type of attachment (optional) + * @param string $filename Optional name of file (optional) + * @param string $x_filename Optional content type header of attachment (optional) + * @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadMultipartFormAsyncWithHttpInfo($content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0]) + { + $returnType = 'string[]'; + $request = $this->uploadMultipartFormRequest($content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'uploadMultipartForm' + * + * @param string $content_type Optional content type of attachment (optional) + * @param string $filename Optional name of file (optional) + * @param string $x_filename Optional content type header of attachment (optional) + * @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function uploadMultipartFormRequest($content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0]) + { + + + + + + + $resourcePath = '/attachments/multipart'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $content_type, + 'contentType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filename, + 'filename', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $x_filename, + 'x-filename', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($upload_multipart_form_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($upload_multipart_form_request)); + } else { + $httpBody = $upload_multipart_form_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/BounceControllerApi.php b/lib/Apis/BounceControllerApi.php new file mode 100644 index 00000000..b446aa7b --- /dev/null +++ b/lib/Apis/BounceControllerApi.php @@ -0,0 +1,2394 @@ + [ + 'application/json', + ], + 'getBouncedEmail' => [ + 'application/json', + ], + 'getBouncedEmails' => [ + 'application/json', + ], + 'getBouncedRecipient' => [ + 'application/json', + ], + 'getBouncedRecipients' => [ + 'application/json', + ], + 'getComplaints' => [ + 'application/json', + ], + 'getListUnsubscribeRecipients' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation filterBouncedRecipient + * + * Filter a list of email recipients and remove those who have bounced + * + * @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options filter_bounced_recipients_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\FilterBouncedRecipientsResult + */ + public function filterBouncedRecipient($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0]) + { + list($response) = $this->filterBouncedRecipientWithHttpInfo($filter_bounced_recipients_options, $contentType); + return $response; + } + + /** + * Operation filterBouncedRecipientWithHttpInfo + * + * Filter a list of email recipients and remove those who have bounced + * + * @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\FilterBouncedRecipientsResult, HTTP status code, HTTP response headers (array of strings) + */ + public function filterBouncedRecipientWithHttpInfo($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0]) + { + $request = $this->filterBouncedRecipientRequest($filter_bounced_recipients_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\FilterBouncedRecipientsResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\FilterBouncedRecipientsResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\FilterBouncedRecipientsResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\FilterBouncedRecipientsResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\FilterBouncedRecipientsResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation filterBouncedRecipientAsync + * + * Filter a list of email recipients and remove those who have bounced + * + * @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function filterBouncedRecipientAsync($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0]) + { + return $this->filterBouncedRecipientAsyncWithHttpInfo($filter_bounced_recipients_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation filterBouncedRecipientAsyncWithHttpInfo + * + * Filter a list of email recipients and remove those who have bounced + * + * @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function filterBouncedRecipientAsyncWithHttpInfo($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0]) + { + $returnType = '\MailSlurp\Models\FilterBouncedRecipientsResult'; + $request = $this->filterBouncedRecipientRequest($filter_bounced_recipients_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'filterBouncedRecipient' + * + * @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function filterBouncedRecipientRequest($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0]) + { + + // verify the required parameter 'filter_bounced_recipients_options' is set + if ($filter_bounced_recipients_options === null || (is_array($filter_bounced_recipients_options) && count($filter_bounced_recipients_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $filter_bounced_recipients_options when calling filterBouncedRecipient' + ); + } + + + $resourcePath = '/bounce/filter-recipients'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($filter_bounced_recipients_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($filter_bounced_recipients_options)); + } else { + $httpBody = $filter_bounced_recipients_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBouncedEmail + * + * Get a bounced email. + * + * @param string $id ID of the bounced email to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\BouncedEmailDto + */ + public function getBouncedEmail($id, string $contentType = self::contentTypes['getBouncedEmail'][0]) + { + list($response) = $this->getBouncedEmailWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getBouncedEmailWithHttpInfo + * + * Get a bounced email. + * + * @param string $id ID of the bounced email to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\BouncedEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getBouncedEmailWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedEmail'][0]) + { + $request = $this->getBouncedEmailRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\BouncedEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\BouncedEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\BouncedEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\BouncedEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\BouncedEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBouncedEmailAsync + * + * Get a bounced email. + * + * @param string $id ID of the bounced email to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedEmailAsync($id, string $contentType = self::contentTypes['getBouncedEmail'][0]) + { + return $this->getBouncedEmailAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBouncedEmailAsyncWithHttpInfo + * + * Get a bounced email. + * + * @param string $id ID of the bounced email to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedEmail'][0]) + { + $returnType = '\MailSlurp\Models\BouncedEmailDto'; + $request = $this->getBouncedEmailRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBouncedEmail' + * + * @param string $id ID of the bounced email to fetch (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBouncedEmailRequest($id, string $contentType = self::contentTypes['getBouncedEmail'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getBouncedEmail' + ); + } + + + $resourcePath = '/bounce/emails/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBouncedEmails + * + * Get paginated list of bounced emails. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageBouncedEmail + */ + public function getBouncedEmails($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0]) + { + list($response) = $this->getBouncedEmailsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getBouncedEmailsWithHttpInfo + * + * Get paginated list of bounced emails. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageBouncedEmail, HTTP status code, HTTP response headers (array of strings) + */ + public function getBouncedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0]) + { + $request = $this->getBouncedEmailsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageBouncedEmail' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageBouncedEmail' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageBouncedEmail', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageBouncedEmail'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageBouncedEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBouncedEmailsAsync + * + * Get paginated list of bounced emails. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0]) + { + return $this->getBouncedEmailsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBouncedEmailsAsyncWithHttpInfo + * + * Get paginated list of bounced emails. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageBouncedEmail'; + $request = $this->getBouncedEmailsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBouncedEmails' + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBouncedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0]) + { + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getBouncedEmails, must be smaller than or equal to 100.'); + } + + + + + + $resourcePath = '/bounce/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBouncedRecipient + * + * Get a bounced email. + * + * @param string $id ID of the bounced recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\BouncedRecipientDto + */ + public function getBouncedRecipient($id, string $contentType = self::contentTypes['getBouncedRecipient'][0]) + { + list($response) = $this->getBouncedRecipientWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getBouncedRecipientWithHttpInfo + * + * Get a bounced email. + * + * @param string $id ID of the bounced recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\BouncedRecipientDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getBouncedRecipientWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedRecipient'][0]) + { + $request = $this->getBouncedRecipientRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\BouncedRecipientDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\BouncedRecipientDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\BouncedRecipientDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\BouncedRecipientDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\BouncedRecipientDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBouncedRecipientAsync + * + * Get a bounced email. + * + * @param string $id ID of the bounced recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedRecipientAsync($id, string $contentType = self::contentTypes['getBouncedRecipient'][0]) + { + return $this->getBouncedRecipientAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBouncedRecipientAsyncWithHttpInfo + * + * Get a bounced email. + * + * @param string $id ID of the bounced recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedRecipientAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedRecipient'][0]) + { + $returnType = '\MailSlurp\Models\BouncedRecipientDto'; + $request = $this->getBouncedRecipientRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBouncedRecipient' + * + * @param string $id ID of the bounced recipient (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBouncedRecipientRequest($id, string $contentType = self::contentTypes['getBouncedRecipient'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getBouncedRecipient' + ); + } + + + $resourcePath = '/bounce/recipients/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBouncedRecipients + * + * Get paginated list of bounced recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageBouncedRecipients + */ + public function getBouncedRecipients($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0]) + { + list($response) = $this->getBouncedRecipientsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getBouncedRecipientsWithHttpInfo + * + * Get paginated list of bounced recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageBouncedRecipients, HTTP status code, HTTP response headers (array of strings) + */ + public function getBouncedRecipientsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0]) + { + $request = $this->getBouncedRecipientsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageBouncedRecipients' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageBouncedRecipients' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageBouncedRecipients', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageBouncedRecipients'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageBouncedRecipients', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBouncedRecipientsAsync + * + * Get paginated list of bounced recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedRecipientsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0]) + { + return $this->getBouncedRecipientsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBouncedRecipientsAsyncWithHttpInfo + * + * Get paginated list of bounced recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBouncedRecipientsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0]) + { + $returnType = '\MailSlurp\Models\PageBouncedRecipients'; + $request = $this->getBouncedRecipientsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBouncedRecipients' + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBouncedRecipientsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0]) + { + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getBouncedRecipients, must be smaller than or equal to 100.'); + } + + + + + + $resourcePath = '/bounce/recipients'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getComplaints + * + * Get paginated list of complaints. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageComplaint + */ + public function getComplaints($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0]) + { + list($response) = $this->getComplaintsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getComplaintsWithHttpInfo + * + * Get paginated list of complaints. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageComplaint, HTTP status code, HTTP response headers (array of strings) + */ + public function getComplaintsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0]) + { + $request = $this->getComplaintsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageComplaint' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageComplaint' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageComplaint', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageComplaint'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageComplaint', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getComplaintsAsync + * + * Get paginated list of complaints. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getComplaintsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0]) + { + return $this->getComplaintsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getComplaintsAsyncWithHttpInfo + * + * Get paginated list of complaints. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getComplaintsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0]) + { + $returnType = '\MailSlurp\Models\PageComplaint'; + $request = $this->getComplaintsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getComplaints' + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getComplaintsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0]) + { + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getComplaints, must be smaller than or equal to 100.'); + } + + + + + + $resourcePath = '/bounce/complaints'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getListUnsubscribeRecipients + * + * Get paginated list of unsubscribed recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $domain_id Filter by domainId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageListUnsubscribeRecipients + */ + public function getListUnsubscribeRecipients($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0]) + { + list($response) = $this->getListUnsubscribeRecipientsWithHttpInfo($page, $size, $sort, $domain_id, $contentType); + return $response; + } + + /** + * Operation getListUnsubscribeRecipientsWithHttpInfo + * + * Get paginated list of unsubscribed recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $domain_id Filter by domainId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageListUnsubscribeRecipients, HTTP status code, HTTP response headers (array of strings) + */ + public function getListUnsubscribeRecipientsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0]) + { + $request = $this->getListUnsubscribeRecipientsRequest($page, $size, $sort, $domain_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageListUnsubscribeRecipients' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageListUnsubscribeRecipients' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageListUnsubscribeRecipients', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageListUnsubscribeRecipients'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageListUnsubscribeRecipients', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getListUnsubscribeRecipientsAsync + * + * Get paginated list of unsubscribed recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $domain_id Filter by domainId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getListUnsubscribeRecipientsAsync($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0]) + { + return $this->getListUnsubscribeRecipientsAsyncWithHttpInfo($page, $size, $sort, $domain_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getListUnsubscribeRecipientsAsyncWithHttpInfo + * + * Get paginated list of unsubscribed recipients. + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $domain_id Filter by domainId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getListUnsubscribeRecipientsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0]) + { + $returnType = '\MailSlurp\Models\PageListUnsubscribeRecipients'; + $request = $this->getListUnsubscribeRecipientsRequest($page, $size, $sort, $domain_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getListUnsubscribeRecipients' + * + * @param int $page Optional page index (optional, default to 0) + * @param int $size Optional page size (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $domain_id Filter by domainId (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getListUnsubscribeRecipientsRequest($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0]) + { + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getListUnsubscribeRecipients, must be smaller than or equal to 100.'); + } + + + + + $resourcePath = '/bounce/list-unsubscribe-recipients'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $domain_id, + 'domainId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/BulkActionsControllerApi.php b/lib/Apis/BulkActionsControllerApi.php new file mode 100644 index 00000000..5fc4920d --- /dev/null +++ b/lib/Apis/BulkActionsControllerApi.php @@ -0,0 +1,905 @@ + [ + 'application/json', + ], + 'bulkDeleteInboxes' => [ + 'application/json', + ], + 'bulkSendEmails' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation bulkCreateInboxes + * + * Bulk create Inboxes (email addresses) + * + * @param int $count Number of inboxes to be created in bulk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto[] + */ + public function bulkCreateInboxes($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0]) + { + list($response) = $this->bulkCreateInboxesWithHttpInfo($count, $contentType); + return $response; + } + + /** + * Operation bulkCreateInboxesWithHttpInfo + * + * Bulk create Inboxes (email addresses) + * + * @param int $count Number of inboxes to be created in bulk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto[], HTTP status code, HTTP response headers (array of strings) + */ + public function bulkCreateInboxesWithHttpInfo($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0]) + { + $request = $this->bulkCreateInboxesRequest($count, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation bulkCreateInboxesAsync + * + * Bulk create Inboxes (email addresses) + * + * @param int $count Number of inboxes to be created in bulk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkCreateInboxesAsync($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0]) + { + return $this->bulkCreateInboxesAsyncWithHttpInfo($count, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkCreateInboxesAsyncWithHttpInfo + * + * Bulk create Inboxes (email addresses) + * + * @param int $count Number of inboxes to be created in bulk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkCreateInboxesAsyncWithHttpInfo($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto[]'; + $request = $this->bulkCreateInboxesRequest($count, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'bulkCreateInboxes' + * + * @param int $count Number of inboxes to be created in bulk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkCreateInboxesRequest($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0]) + { + + // verify the required parameter 'count' is set + if ($count === null || (is_array($count) && count($count) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $count when calling bulkCreateInboxes' + ); + } + + + $resourcePath = '/bulk/inboxes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $count, + 'count', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation bulkDeleteInboxes + * + * Bulk Delete Inboxes + * + * @param string[] $request_body request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function bulkDeleteInboxes($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0]) + { + $this->bulkDeleteInboxesWithHttpInfo($request_body, $contentType); + } + + /** + * Operation bulkDeleteInboxesWithHttpInfo + * + * Bulk Delete Inboxes + * + * @param string[] $request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkDeleteInboxesWithHttpInfo($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0]) + { + $request = $this->bulkDeleteInboxesRequest($request_body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation bulkDeleteInboxesAsync + * + * Bulk Delete Inboxes + * + * @param string[] $request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkDeleteInboxesAsync($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0]) + { + return $this->bulkDeleteInboxesAsyncWithHttpInfo($request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkDeleteInboxesAsyncWithHttpInfo + * + * Bulk Delete Inboxes + * + * @param string[] $request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkDeleteInboxesAsyncWithHttpInfo($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0]) + { + $returnType = ''; + $request = $this->bulkDeleteInboxesRequest($request_body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'bulkDeleteInboxes' + * + * @param string[] $request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkDeleteInboxesRequest($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0]) + { + + // verify the required parameter 'request_body' is set + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling bulkDeleteInboxes' + ); + } + + + $resourcePath = '/bulk/inboxes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $request_body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation bulkSendEmails + * + * Bulk Send Emails + * + * @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options bulk_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function bulkSendEmails($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0]) + { + $this->bulkSendEmailsWithHttpInfo($bulk_send_email_options, $contentType); + } + + /** + * Operation bulkSendEmailsWithHttpInfo + * + * Bulk Send Emails + * + * @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkSendEmailsWithHttpInfo($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0]) + { + $request = $this->bulkSendEmailsRequest($bulk_send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation bulkSendEmailsAsync + * + * Bulk Send Emails + * + * @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkSendEmailsAsync($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0]) + { + return $this->bulkSendEmailsAsyncWithHttpInfo($bulk_send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkSendEmailsAsyncWithHttpInfo + * + * Bulk Send Emails + * + * @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkSendEmailsAsyncWithHttpInfo($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0]) + { + $returnType = ''; + $request = $this->bulkSendEmailsRequest($bulk_send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'bulkSendEmails' + * + * @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkSendEmailsRequest($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0]) + { + + // verify the required parameter 'bulk_send_email_options' is set + if ($bulk_send_email_options === null || (is_array($bulk_send_email_options) && count($bulk_send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bulk_send_email_options when calling bulkSendEmails' + ); + } + + + $resourcePath = '/bulk/send'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($bulk_send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($bulk_send_email_options)); + } else { + $httpBody = $bulk_send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/CommonActionsControllerApi.php b/lib/Apis/CommonActionsControllerApi.php new file mode 100644 index 00000000..887757e1 --- /dev/null +++ b/lib/Apis/CommonActionsControllerApi.php @@ -0,0 +1,1755 @@ + [ + 'application/json', + ], + 'createRandomInbox' => [ + 'application/json', + ], + 'deleteEmailAddress' => [ + 'application/json', + ], + 'emptyInbox' => [ + 'application/json', + ], + 'sendEmailSimple' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createNewEmailAddress + * + * Create new random inbox + * + * @param bool $allow_team_access allow_team_access (optional) + * @param bool $use_domain_pool use_domain_pool (optional) + * @param \DateTime $expires_at expires_at (optional) + * @param int $expires_in expires_in (optional) + * @param string $email_address email_address (optional) + * @param string $inbox_type inbox_type (optional) + * @param string $description description (optional) + * @param string $name name (optional) + * @param string[] $tags tags (optional) + * @param bool $favourite favourite (optional) + * @param bool $virtual_inbox virtual_inbox (optional) + * @param bool $use_short_address use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function createNewEmailAddress($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createNewEmailAddress'][0]) + { + list($response) = $this->createNewEmailAddressWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + return $response; + } + + /** + * Operation createNewEmailAddressWithHttpInfo + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createNewEmailAddressWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createNewEmailAddress'][0]) + { + $request = $this->createNewEmailAddressRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createNewEmailAddressAsync + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewEmailAddressAsync($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createNewEmailAddress'][0]) + { + return $this->createNewEmailAddressAsyncWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createNewEmailAddressAsyncWithHttpInfo + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewEmailAddressAsyncWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createNewEmailAddress'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->createNewEmailAddressRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createNewEmailAddress' + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createNewEmailAddressRequest($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createNewEmailAddress'][0]) + { + + + + + + + + + + + + + + + $resourcePath = '/newEmailAddress'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $allow_team_access, + 'allowTeamAccess', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_domain_pool, + 'useDomainPool', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at, + 'expiresAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_in, + 'expiresIn', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_type, + 'inboxType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $description, + 'description', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tags, + 'tags', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $favourite, + 'favourite', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $virtual_inbox, + 'virtualInbox', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_short_address, + 'useShortAddress', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createRandomInbox + * + * Create new random inbox + * + * @param bool $allow_team_access allow_team_access (optional) + * @param bool $use_domain_pool use_domain_pool (optional) + * @param \DateTime $expires_at expires_at (optional) + * @param int $expires_in expires_in (optional) + * @param string $email_address email_address (optional) + * @param string $inbox_type inbox_type (optional) + * @param string $description description (optional) + * @param string $name name (optional) + * @param string[] $tags tags (optional) + * @param bool $favourite favourite (optional) + * @param bool $virtual_inbox virtual_inbox (optional) + * @param bool $use_short_address use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function createRandomInbox($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createRandomInbox'][0]) + { + list($response) = $this->createRandomInboxWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + return $response; + } + + /** + * Operation createRandomInboxWithHttpInfo + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createRandomInboxWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createRandomInbox'][0]) + { + $request = $this->createRandomInboxRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createRandomInboxAsync + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRandomInboxAsync($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createRandomInbox'][0]) + { + return $this->createRandomInboxAsyncWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createRandomInboxAsyncWithHttpInfo + * + * Create new random inbox + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRandomInboxAsyncWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createRandomInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->createRandomInboxRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createRandomInbox' + * + * @param bool $allow_team_access (optional) + * @param bool $use_domain_pool (optional) + * @param \DateTime $expires_at (optional) + * @param int $expires_in (optional) + * @param string $email_address (optional) + * @param string $inbox_type (optional) + * @param string $description (optional) + * @param string $name (optional) + * @param string[] $tags (optional) + * @param bool $favourite (optional) + * @param bool $virtual_inbox (optional) + * @param bool $use_short_address (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRandomInboxRequest($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createRandomInbox'][0]) + { + + + + + + + + + + + + + + + $resourcePath = '/createInbox'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $allow_team_access, + 'allowTeamAccess', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_domain_pool, + 'useDomainPool', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at, + 'expiresAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_in, + 'expiresIn', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_type, + 'inboxType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $description, + 'description', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tags, + 'tags', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $favourite, + 'favourite', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $virtual_inbox, + 'virtualInbox', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_short_address, + 'useShortAddress', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteEmailAddress + * + * Delete inbox email address by inbox id + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteEmailAddress($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0]) + { + $this->deleteEmailAddressWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation deleteEmailAddressWithHttpInfo + * + * Delete inbox email address by inbox id + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteEmailAddressWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0]) + { + $request = $this->deleteEmailAddressRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteEmailAddressAsync + * + * Delete inbox email address by inbox id + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmailAddressAsync($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0]) + { + return $this->deleteEmailAddressAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEmailAddressAsyncWithHttpInfo + * + * Delete inbox email address by inbox id + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmailAddressAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0]) + { + $returnType = ''; + $request = $this->deleteEmailAddressRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteEmailAddress' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEmailAddressRequest($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling deleteEmailAddress' + ); + } + + + $resourcePath = '/deleteEmailAddress'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation emptyInbox + * + * Delete all emails in an inbox + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function emptyInbox($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0]) + { + $this->emptyInboxWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation emptyInboxWithHttpInfo + * + * Delete all emails in an inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function emptyInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0]) + { + $request = $this->emptyInboxRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation emptyInboxAsync + * + * Delete all emails in an inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emptyInboxAsync($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0]) + { + return $this->emptyInboxAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation emptyInboxAsyncWithHttpInfo + * + * Delete all emails in an inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function emptyInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0]) + { + $returnType = ''; + $request = $this->emptyInboxRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'emptyInbox' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function emptyInboxRequest($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling emptyInbox' + ); + } + + + $resourcePath = '/emptyInbox'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendEmailSimple + * + * Send an email + * + * @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options simple_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendEmailSimple($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0]) + { + $this->sendEmailSimpleWithHttpInfo($simple_send_email_options, $contentType); + } + + /** + * Operation sendEmailSimpleWithHttpInfo + * + * Send an email + * + * @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailSimpleWithHttpInfo($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0]) + { + $request = $this->sendEmailSimpleRequest($simple_send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation sendEmailSimpleAsync + * + * Send an email + * + * @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailSimpleAsync($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0]) + { + return $this->sendEmailSimpleAsyncWithHttpInfo($simple_send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendEmailSimpleAsyncWithHttpInfo + * + * Send an email + * + * @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailSimpleAsyncWithHttpInfo($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0]) + { + $returnType = ''; + $request = $this->sendEmailSimpleRequest($simple_send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendEmailSimple' + * + * @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendEmailSimpleRequest($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0]) + { + + // verify the required parameter 'simple_send_email_options' is set + if ($simple_send_email_options === null || (is_array($simple_send_email_options) && count($simple_send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_send_email_options when calling sendEmailSimple' + ); + } + + + $resourcePath = '/sendEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($simple_send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_send_email_options)); + } else { + $httpBody = $simple_send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/ContactControllerApi.php b/lib/Apis/ContactControllerApi.php new file mode 100644 index 00000000..384ce281 --- /dev/null +++ b/lib/Apis/ContactControllerApi.php @@ -0,0 +1,1867 @@ + [ + 'application/json', + ], + 'deleteContact' => [ + 'application/json', + ], + 'getAllContacts' => [ + 'application/json', + ], + 'getContact' => [ + 'application/json', + ], + 'getContactVCard' => [ + 'application/json', + ], + 'getContacts' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createContact + * + * Create a contact + * + * @param \MailSlurp\Models\CreateContactOptions $create_contact_options create_contact_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ContactDto + */ + public function createContact($create_contact_options, string $contentType = self::contentTypes['createContact'][0]) + { + list($response) = $this->createContactWithHttpInfo($create_contact_options, $contentType); + return $response; + } + + /** + * Operation createContactWithHttpInfo + * + * Create a contact + * + * @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ContactDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createContactWithHttpInfo($create_contact_options, string $contentType = self::contentTypes['createContact'][0]) + { + $request = $this->createContactRequest($create_contact_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\ContactDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ContactDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ContactDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ContactDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createContactAsync + * + * Create a contact + * + * @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsync($create_contact_options, string $contentType = self::contentTypes['createContact'][0]) + { + return $this->createContactAsyncWithHttpInfo($create_contact_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createContactAsyncWithHttpInfo + * + * Create a contact + * + * @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsyncWithHttpInfo($create_contact_options, string $contentType = self::contentTypes['createContact'][0]) + { + $returnType = '\MailSlurp\Models\ContactDto'; + $request = $this->createContactRequest($create_contact_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createContact' + * + * @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createContactRequest($create_contact_options, string $contentType = self::contentTypes['createContact'][0]) + { + + // verify the required parameter 'create_contact_options' is set + if ($create_contact_options === null || (is_array($create_contact_options) && count($create_contact_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_contact_options when calling createContact' + ); + } + + + $resourcePath = '/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_contact_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_contact_options)); + } else { + $httpBody = $create_contact_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteContact + * + * Delete contact + * + * @param string $contact_id contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteContact($contact_id, string $contentType = self::contentTypes['deleteContact'][0]) + { + $this->deleteContactWithHttpInfo($contact_id, $contentType); + } + + /** + * Operation deleteContactWithHttpInfo + * + * Delete contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteContactWithHttpInfo($contact_id, string $contentType = self::contentTypes['deleteContact'][0]) + { + $request = $this->deleteContactRequest($contact_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteContactAsync + * + * Delete contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsync($contact_id, string $contentType = self::contentTypes['deleteContact'][0]) + { + return $this->deleteContactAsyncWithHttpInfo($contact_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteContactAsyncWithHttpInfo + * + * Delete contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['deleteContact'][0]) + { + $returnType = ''; + $request = $this->deleteContactRequest($contact_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteContact' + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteContactRequest($contact_id, string $contentType = self::contentTypes['deleteContact'][0]) + { + + // verify the required parameter 'contact_id' is set + if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contact_id when calling deleteContact' + ); + } + + + $resourcePath = '/contacts/{contactId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($contact_id !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contact_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllContacts + * + * Get all contacts + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageContactProjection + */ + public function getAllContacts($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllContacts'][0]) + { + list($response) = $this->getAllContactsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllContactsWithHttpInfo + * + * Get all contacts + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageContactProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllContactsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllContacts'][0]) + { + $request = $this->getAllContactsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageContactProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageContactProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageContactProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageContactProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageContactProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllContactsAsync + * + * Get all contacts + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllContactsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllContacts'][0]) + { + return $this->getAllContactsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllContactsAsyncWithHttpInfo + * + * Get all contacts + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllContactsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllContacts'][0]) + { + $returnType = '\MailSlurp\Models\PageContactProjection'; + $request = $this->getAllContactsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllContacts' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllContactsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllContacts'][0]) + { + + + + + + + + $resourcePath = '/contacts/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getContact + * + * Get contact + * + * @param string $contact_id contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ContactDto + */ + public function getContact($contact_id, string $contentType = self::contentTypes['getContact'][0]) + { + list($response) = $this->getContactWithHttpInfo($contact_id, $contentType); + return $response; + } + + /** + * Operation getContactWithHttpInfo + * + * Get contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ContactDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContact'][0]) + { + $request = $this->getContactRequest($contact_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ContactDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ContactDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ContactDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ContactDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getContactAsync + * + * Get contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactAsync($contact_id, string $contentType = self::contentTypes['getContact'][0]) + { + return $this->getContactAsyncWithHttpInfo($contact_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getContactAsyncWithHttpInfo + * + * Get contact + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContact'][0]) + { + $returnType = '\MailSlurp\Models\ContactDto'; + $request = $this->getContactRequest($contact_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getContact' + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getContactRequest($contact_id, string $contentType = self::contentTypes['getContact'][0]) + { + + // verify the required parameter 'contact_id' is set + if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contact_id when calling getContact' + ); + } + + + $resourcePath = '/contacts/{contactId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($contact_id !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contact_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getContactVCard + * + * Get contact vCard vcf file + * + * @param string $contact_id contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function getContactVCard($contact_id, string $contentType = self::contentTypes['getContactVCard'][0]) + { + list($response) = $this->getContactVCardWithHttpInfo($contact_id, $contentType); + return $response; + } + + /** + * Operation getContactVCardWithHttpInfo + * + * Get contact vCard vcf file + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function getContactVCardWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContactVCard'][0]) + { + $request = $this->getContactVCardRequest($contact_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getContactVCardAsync + * + * Get contact vCard vcf file + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactVCardAsync($contact_id, string $contentType = self::contentTypes['getContactVCard'][0]) + { + return $this->getContactVCardAsyncWithHttpInfo($contact_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getContactVCardAsyncWithHttpInfo + * + * Get contact vCard vcf file + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactVCardAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContactVCard'][0]) + { + $returnType = 'string[]'; + $request = $this->getContactVCardRequest($contact_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getContactVCard' + * + * @param string $contact_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getContactVCardRequest($contact_id, string $contentType = self::contentTypes['getContactVCard'][0]) + { + + // verify the required parameter 'contact_id' is set + if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contact_id when calling getContactVCard' + ); + } + + + $resourcePath = '/contacts/{contactId}/download'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($contact_id !== null) { + $resourcePath = str_replace( + '{' . 'contactId' . '}', + ObjectSerializer::toPathValue($contact_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getContacts + * + * Get all contacts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ContactProjection[] + */ + public function getContacts(string $contentType = self::contentTypes['getContacts'][0]) + { + list($response) = $this->getContactsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getContactsWithHttpInfo + * + * Get all contacts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ContactProjection[], HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsWithHttpInfo(string $contentType = self::contentTypes['getContacts'][0]) + { + $request = $this->getContactsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ContactProjection[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ContactProjection[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactProjection[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ContactProjection[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ContactProjection[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getContactsAsync + * + * Get all contacts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactsAsync(string $contentType = self::contentTypes['getContacts'][0]) + { + return $this->getContactsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getContactsAsyncWithHttpInfo + * + * Get all contacts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactsAsyncWithHttpInfo(string $contentType = self::contentTypes['getContacts'][0]) + { + $returnType = '\MailSlurp\Models\ContactProjection[]'; + $request = $this->getContactsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getContacts' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getContactsRequest(string $contentType = self::contentTypes['getContacts'][0]) + { + + + $resourcePath = '/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/DomainControllerApi.php b/lib/Apis/DomainControllerApi.php new file mode 100644 index 00000000..76de185d --- /dev/null +++ b/lib/Apis/DomainControllerApi.php @@ -0,0 +1,2176 @@ + [ + 'application/json', + ], + 'createDomain' => [ + 'application/json', + ], + 'deleteDomain' => [ + 'application/json', + ], + 'getDomain' => [ + 'application/json', + ], + 'getDomainWildcardCatchAllInbox' => [ + 'application/json', + ], + 'getDomains' => [ + 'application/json', + ], + 'updateDomain' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation addDomainWildcardCatchAll + * + * Add catch all wild card inbox to domain + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DomainDto + */ + public function addDomainWildcardCatchAll($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0]) + { + list($response) = $this->addDomainWildcardCatchAllWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation addDomainWildcardCatchAllWithHttpInfo + * + * Add catch all wild card inbox to domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings) + */ + public function addDomainWildcardCatchAllWithHttpInfo($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0]) + { + $request = $this->addDomainWildcardCatchAllRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DomainDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DomainDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DomainDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addDomainWildcardCatchAllAsync + * + * Add catch all wild card inbox to domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addDomainWildcardCatchAllAsync($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0]) + { + return $this->addDomainWildcardCatchAllAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addDomainWildcardCatchAllAsyncWithHttpInfo + * + * Add catch all wild card inbox to domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addDomainWildcardCatchAllAsyncWithHttpInfo($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0]) + { + $returnType = '\MailSlurp\Models\DomainDto'; + $request = $this->addDomainWildcardCatchAllRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addDomainWildcardCatchAll' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addDomainWildcardCatchAllRequest($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling addDomainWildcardCatchAll' + ); + } + + + $resourcePath = '/domains/{id}/wildcard'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createDomain + * + * Create Domain + * + * @param \MailSlurp\Models\CreateDomainOptions $create_domain_options create_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DomainDto + */ + public function createDomain($create_domain_options, string $contentType = self::contentTypes['createDomain'][0]) + { + list($response) = $this->createDomainWithHttpInfo($create_domain_options, $contentType); + return $response; + } + + /** + * Operation createDomainWithHttpInfo + * + * Create Domain + * + * @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createDomainWithHttpInfo($create_domain_options, string $contentType = self::contentTypes['createDomain'][0]) + { + $request = $this->createDomainRequest($create_domain_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DomainDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DomainDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DomainDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createDomainAsync + * + * Create Domain + * + * @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDomainAsync($create_domain_options, string $contentType = self::contentTypes['createDomain'][0]) + { + return $this->createDomainAsyncWithHttpInfo($create_domain_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDomainAsyncWithHttpInfo + * + * Create Domain + * + * @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDomainAsyncWithHttpInfo($create_domain_options, string $contentType = self::contentTypes['createDomain'][0]) + { + $returnType = '\MailSlurp\Models\DomainDto'; + $request = $this->createDomainRequest($create_domain_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createDomain' + * + * @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDomainRequest($create_domain_options, string $contentType = self::contentTypes['createDomain'][0]) + { + + // verify the required parameter 'create_domain_options' is set + if ($create_domain_options === null || (is_array($create_domain_options) && count($create_domain_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_domain_options when calling createDomain' + ); + } + + + $resourcePath = '/domains'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_domain_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_domain_options)); + } else { + $httpBody = $create_domain_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteDomain + * + * Delete a domain + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function deleteDomain($id, string $contentType = self::contentTypes['deleteDomain'][0]) + { + list($response) = $this->deleteDomainWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation deleteDomainWithHttpInfo + * + * Delete a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function deleteDomainWithHttpInfo($id, string $contentType = self::contentTypes['deleteDomain'][0]) + { + $request = $this->deleteDomainRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 204: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 204: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteDomainAsync + * + * Delete a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteDomainAsync($id, string $contentType = self::contentTypes['deleteDomain'][0]) + { + return $this->deleteDomainAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteDomainAsyncWithHttpInfo + * + * Delete a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteDomainAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteDomain'][0]) + { + $returnType = 'string[]'; + $request = $this->deleteDomainRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteDomain' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteDomainRequest($id, string $contentType = self::contentTypes['deleteDomain'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteDomain' + ); + } + + + $resourcePath = '/domains/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDomain + * + * Get a domain + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DomainDto + */ + public function getDomain($id, string $contentType = self::contentTypes['getDomain'][0]) + { + list($response) = $this->getDomainWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getDomainWithHttpInfo + * + * Get a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getDomainWithHttpInfo($id, string $contentType = self::contentTypes['getDomain'][0]) + { + $request = $this->getDomainRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DomainDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DomainDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DomainDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDomainAsync + * + * Get a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainAsync($id, string $contentType = self::contentTypes['getDomain'][0]) + { + return $this->getDomainAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDomainAsyncWithHttpInfo + * + * Get a domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getDomain'][0]) + { + $returnType = '\MailSlurp\Models\DomainDto'; + $request = $this->getDomainRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDomain' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDomainRequest($id, string $contentType = self::contentTypes['getDomain'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDomain' + ); + } + + + $resourcePath = '/domains/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDomainWildcardCatchAllInbox + * + * Get catch all wild card inbox for domain + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function getDomainWildcardCatchAllInbox($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0]) + { + list($response) = $this->getDomainWildcardCatchAllInboxWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getDomainWildcardCatchAllInboxWithHttpInfo + * + * Get catch all wild card inbox for domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getDomainWildcardCatchAllInboxWithHttpInfo($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0]) + { + $request = $this->getDomainWildcardCatchAllInboxRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDomainWildcardCatchAllInboxAsync + * + * Get catch all wild card inbox for domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainWildcardCatchAllInboxAsync($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0]) + { + return $this->getDomainWildcardCatchAllInboxAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDomainWildcardCatchAllInboxAsyncWithHttpInfo + * + * Get catch all wild card inbox for domain + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainWildcardCatchAllInboxAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->getDomainWildcardCatchAllInboxRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDomainWildcardCatchAllInbox' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDomainWildcardCatchAllInboxRequest($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDomainWildcardCatchAllInbox' + ); + } + + + $resourcePath = '/domains/{id}/wildcard'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDomains + * + * Get domains + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DomainPreview[] + */ + public function getDomains(string $contentType = self::contentTypes['getDomains'][0]) + { + list($response) = $this->getDomainsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getDomainsWithHttpInfo + * + * Get domains + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DomainPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function getDomainsWithHttpInfo(string $contentType = self::contentTypes['getDomains'][0]) + { + $request = $this->getDomainsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DomainPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DomainPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DomainPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DomainPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDomainsAsync + * + * Get domains + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainsAsync(string $contentType = self::contentTypes['getDomains'][0]) + { + return $this->getDomainsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDomainsAsyncWithHttpInfo + * + * Get domains + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDomainsAsyncWithHttpInfo(string $contentType = self::contentTypes['getDomains'][0]) + { + $returnType = '\MailSlurp\Models\DomainPreview[]'; + $request = $this->getDomainsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDomains' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDomainsRequest(string $contentType = self::contentTypes['getDomains'][0]) + { + + + $resourcePath = '/domains'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateDomain + * + * Update a domain + * + * @param string $id id (required) + * @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options update_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DomainDto + */ + public function updateDomain($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0]) + { + list($response) = $this->updateDomainWithHttpInfo($id, $update_domain_options, $contentType); + return $response; + } + + /** + * Operation updateDomainWithHttpInfo + * + * Update a domain + * + * @param string $id (required) + * @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateDomainWithHttpInfo($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0]) + { + $request = $this->updateDomainRequest($id, $update_domain_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DomainDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DomainDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DomainDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateDomainAsync + * + * Update a domain + * + * @param string $id (required) + * @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateDomainAsync($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0]) + { + return $this->updateDomainAsyncWithHttpInfo($id, $update_domain_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateDomainAsyncWithHttpInfo + * + * Update a domain + * + * @param string $id (required) + * @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateDomainAsyncWithHttpInfo($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0]) + { + $returnType = '\MailSlurp\Models\DomainDto'; + $request = $this->updateDomainRequest($id, $update_domain_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateDomain' + * + * @param string $id (required) + * @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateDomainRequest($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateDomain' + ); + } + + // verify the required parameter 'update_domain_options' is set + if ($update_domain_options === null || (is_array($update_domain_options) && count($update_domain_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_domain_options when calling updateDomain' + ); + } + + + $resourcePath = '/domains/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_domain_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_domain_options)); + } else { + $httpBody = $update_domain_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/EmailControllerApi.php b/lib/Apis/EmailControllerApi.php new file mode 100644 index 00000000..503fa42f --- /dev/null +++ b/lib/Apis/EmailControllerApi.php @@ -0,0 +1,9456 @@ + [ + 'application/json', + ], + 'deleteAllEmails' => [ + 'application/json', + ], + 'deleteEmail' => [ + 'application/json', + ], + 'downloadAttachment' => [ + 'application/json', + ], + 'downloadAttachmentBase64' => [ + 'application/json', + ], + 'downloadBody' => [ + 'application/json', + ], + 'downloadBodyBytes' => [ + 'application/json', + ], + 'forwardEmail' => [ + 'application/json', + ], + 'getAttachmentMetaData' => [ + 'application/json', + ], + 'getEmail' => [ + 'application/json', + ], + 'getEmailAttachments' => [ + 'application/json', + ], + 'getEmailContentMatch' => [ + 'application/json', + ], + 'getEmailCount' => [ + 'application/json', + ], + 'getEmailHTML' => [ + 'application/json', + ], + 'getEmailHTMLJson' => [ + 'application/json', + ], + 'getEmailHTMLQuery' => [ + 'application/json', + ], + 'getEmailLinks' => [ + 'application/json', + ], + 'getEmailPreviewURLs' => [ + 'application/json', + ], + 'getEmailTextLines' => [ + 'application/json', + ], + 'getEmailsPaginated' => [ + 'application/json', + ], + 'getGravatarUrlForEmailAddress' => [ + 'application/json', + ], + 'getLatestEmail' => [ + 'application/json', + ], + 'getLatestEmailInInbox1' => [ + 'application/json', + ], + 'getOrganizationEmailsPaginated' => [ + 'application/json', + ], + 'getRawEmailContents' => [ + 'application/json', + ], + 'getRawEmailJson' => [ + 'application/json', + ], + 'getUnreadEmailCount' => [ + 'application/json', + ], + 'markAsRead' => [ + 'application/json', + ], + 'replyToEmail' => [ + 'application/json', + ], + 'sendEmailSourceOptional' => [ + 'application/json', + ], + 'validateEmail' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation applyImapFlagOperation + * + * Set IMAP flags associated with a message. Only supports '\\Seen' flag. + * + * @param string $email_id email_id (required) + * @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options imap_flag_operation_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview + */ + public function applyImapFlagOperation($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0]) + { + list($response) = $this->applyImapFlagOperationWithHttpInfo($email_id, $imap_flag_operation_options, $contentType); + return $response; + } + + /** + * Operation applyImapFlagOperationWithHttpInfo + * + * Set IMAP flags associated with a message. Only supports '\\Seen' flag. + * + * @param string $email_id (required) + * @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview, HTTP status code, HTTP response headers (array of strings) + */ + public function applyImapFlagOperationWithHttpInfo($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0]) + { + $request = $this->applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation applyImapFlagOperationAsync + * + * Set IMAP flags associated with a message. Only supports '\\Seen' flag. + * + * @param string $email_id (required) + * @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function applyImapFlagOperationAsync($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0]) + { + return $this->applyImapFlagOperationAsyncWithHttpInfo($email_id, $imap_flag_operation_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation applyImapFlagOperationAsyncWithHttpInfo + * + * Set IMAP flags associated with a message. Only supports '\\Seen' flag. + * + * @param string $email_id (required) + * @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function applyImapFlagOperationAsyncWithHttpInfo($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview'; + $request = $this->applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'applyImapFlagOperation' + * + * @param string $email_id (required) + * @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling applyImapFlagOperation' + ); + } + + // verify the required parameter 'imap_flag_operation_options' is set + if ($imap_flag_operation_options === null || (is_array($imap_flag_operation_options) && count($imap_flag_operation_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $imap_flag_operation_options when calling applyImapFlagOperation' + ); + } + + + $resourcePath = '/emails/{emailId}/imap-flag-operation'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($imap_flag_operation_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_flag_operation_options)); + } else { + $httpBody = $imap_flag_operation_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAllEmails + * + * Delete all emails in all inboxes. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllEmails(string $contentType = self::contentTypes['deleteAllEmails'][0]) + { + $this->deleteAllEmailsWithHttpInfo($contentType); + } + + /** + * Operation deleteAllEmailsWithHttpInfo + * + * Delete all emails in all inboxes. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllEmailsWithHttpInfo(string $contentType = self::contentTypes['deleteAllEmails'][0]) + { + $request = $this->deleteAllEmailsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllEmailsAsync + * + * Delete all emails in all inboxes. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllEmailsAsync(string $contentType = self::contentTypes['deleteAllEmails'][0]) + { + return $this->deleteAllEmailsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllEmailsAsyncWithHttpInfo + * + * Delete all emails in all inboxes. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllEmails'][0]) + { + $returnType = ''; + $request = $this->deleteAllEmailsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllEmails' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllEmailsRequest(string $contentType = self::contentTypes['deleteAllEmails'][0]) + { + + + $resourcePath = '/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteEmail + * + * Delete an email + * + * @param string $email_id ID of email to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteEmail($email_id, string $contentType = self::contentTypes['deleteEmail'][0]) + { + $this->deleteEmailWithHttpInfo($email_id, $contentType); + } + + /** + * Operation deleteEmailWithHttpInfo + * + * Delete an email + * + * @param string $email_id ID of email to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteEmailWithHttpInfo($email_id, string $contentType = self::contentTypes['deleteEmail'][0]) + { + $request = $this->deleteEmailRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteEmailAsync + * + * Delete an email + * + * @param string $email_id ID of email to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmailAsync($email_id, string $contentType = self::contentTypes['deleteEmail'][0]) + { + return $this->deleteEmailAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEmailAsyncWithHttpInfo + * + * Delete an email + * + * @param string $email_id ID of email to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmailAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['deleteEmail'][0]) + { + $returnType = ''; + $request = $this->deleteEmailRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteEmail' + * + * @param string $email_id ID of email to delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEmailRequest($email_id, string $contentType = self::contentTypes['deleteEmail'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling deleteEmail' + ); + } + + + $resourcePath = '/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadAttachment + * + * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function downloadAttachment($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0]) + { + list($response) = $this->downloadAttachmentWithHttpInfo($email_id, $attachment_id, $api_key, $contentType); + return $response; + } + + /** + * Operation downloadAttachmentWithHttpInfo + * + * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadAttachmentWithHttpInfo($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0]) + { + $request = $this->downloadAttachmentRequest($email_id, $attachment_id, $api_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + default: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadAttachmentAsync + * + * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsync($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0]) + { + return $this->downloadAttachmentAsyncWithHttpInfo($email_id, $attachment_id, $api_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadAttachmentAsyncWithHttpInfo + * + * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentAsyncWithHttpInfo($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0]) + { + $returnType = 'string'; + $request = $this->downloadAttachmentRequest($email_id, $attachment_id, $api_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadAttachment' + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadAttachmentRequest($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling downloadAttachment' + ); + } + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling downloadAttachment' + ); + } + + + + $resourcePath = '/emails/{emailId}/attachments/{attachmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $api_key, + 'apiKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadAttachmentBase64 + * + * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DownloadAttachmentDto + */ + public function downloadAttachmentBase64($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0]) + { + list($response) = $this->downloadAttachmentBase64WithHttpInfo($email_id, $attachment_id, $contentType); + return $response; + } + + /** + * Operation downloadAttachmentBase64WithHttpInfo + * + * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DownloadAttachmentDto, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadAttachmentBase64WithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0]) + { + $request = $this->downloadAttachmentBase64Request($email_id, $attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DownloadAttachmentDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DownloadAttachmentDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DownloadAttachmentDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DownloadAttachmentDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DownloadAttachmentDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadAttachmentBase64Async + * + * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentBase64Async($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0]) + { + return $this->downloadAttachmentBase64AsyncWithHttpInfo($email_id, $attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadAttachmentBase64AsyncWithHttpInfo + * + * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAttachmentBase64AsyncWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0]) + { + $returnType = '\MailSlurp\Models\DownloadAttachmentDto'; + $request = $this->downloadAttachmentBase64Request($email_id, $attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadAttachmentBase64' + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadAttachmentBase64Request($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling downloadAttachmentBase64' + ); + } + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling downloadAttachmentBase64' + ); + } + + + $resourcePath = '/emails/{emailId}/attachments/{attachmentId}/base64'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadBody + * + * Get email body as string. Returned as `plain/text` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function downloadBody($email_id, string $contentType = self::contentTypes['downloadBody'][0]) + { + list($response) = $this->downloadBodyWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation downloadBodyWithHttpInfo + * + * Get email body as string. Returned as `plain/text` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadBodyWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBody'][0]) + { + $request = $this->downloadBodyRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadBodyAsync + * + * Get email body as string. Returned as `plain/text` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadBodyAsync($email_id, string $contentType = self::contentTypes['downloadBody'][0]) + { + return $this->downloadBodyAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadBodyAsyncWithHttpInfo + * + * Get email body as string. Returned as `plain/text` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadBodyAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBody'][0]) + { + $returnType = 'string'; + $request = $this->downloadBodyRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadBody' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadBodyRequest($email_id, string $contentType = self::contentTypes['downloadBody'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling downloadBody' + ); + } + + + $resourcePath = '/emails/{emailId}/body'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', 'text/html', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadBodyBytes + * + * Get email body in bytes. Returned as `octet-stream` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function downloadBodyBytes($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0]) + { + list($response) = $this->downloadBodyBytesWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation downloadBodyBytesWithHttpInfo + * + * Get email body in bytes. Returned as `octet-stream` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadBodyBytesWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0]) + { + $request = $this->downloadBodyBytesRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + default: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadBodyBytesAsync + * + * Get email body in bytes. Returned as `octet-stream` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadBodyBytesAsync($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0]) + { + return $this->downloadBodyBytesAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadBodyBytesAsyncWithHttpInfo + * + * Get email body in bytes. Returned as `octet-stream` with content type header. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadBodyBytesAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0]) + { + $returnType = 'string'; + $request = $this->downloadBodyBytesRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadBodyBytes' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadBodyBytesRequest($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling downloadBodyBytes' + ); + } + + + $resourcePath = '/emails/{emailId}/body-bytes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forwardEmail + * + * Forward email to recipients + * + * @param string $email_id ID of email (required) + * @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options forward_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function forwardEmail($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0]) + { + list($response) = $this->forwardEmailWithHttpInfo($email_id, $forward_email_options, $contentType); + return $response; + } + + /** + * Operation forwardEmailWithHttpInfo + * + * Forward email to recipients + * + * @param string $email_id ID of email (required) + * @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function forwardEmailWithHttpInfo($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0]) + { + $request = $this->forwardEmailRequest($email_id, $forward_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation forwardEmailAsync + * + * Forward email to recipients + * + * @param string $email_id ID of email (required) + * @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forwardEmailAsync($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0]) + { + return $this->forwardEmailAsyncWithHttpInfo($email_id, $forward_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forwardEmailAsyncWithHttpInfo + * + * Forward email to recipients + * + * @param string $email_id ID of email (required) + * @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forwardEmailAsyncWithHttpInfo($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->forwardEmailRequest($email_id, $forward_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forwardEmail' + * + * @param string $email_id ID of email (required) + * @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function forwardEmailRequest($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling forwardEmail' + ); + } + + // verify the required parameter 'forward_email_options' is set + if ($forward_email_options === null || (is_array($forward_email_options) && count($forward_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $forward_email_options when calling forwardEmail' + ); + } + + + $resourcePath = '/emails/{emailId}/forward'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($forward_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($forward_email_options)); + } else { + $httpBody = $forward_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAttachmentMetaData + * + * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AttachmentMetaData + */ + public function getAttachmentMetaData($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0]) + { + list($response) = $this->getAttachmentMetaDataWithHttpInfo($email_id, $attachment_id, $contentType); + return $response; + } + + /** + * Operation getAttachmentMetaDataWithHttpInfo + * + * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AttachmentMetaData, HTTP status code, HTTP response headers (array of strings) + */ + public function getAttachmentMetaDataWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0]) + { + $request = $this->getAttachmentMetaDataRequest($email_id, $attachment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AttachmentMetaData' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AttachmentMetaData' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AttachmentMetaData'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AttachmentMetaData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttachmentMetaDataAsync + * + * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentMetaDataAsync($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0]) + { + return $this->getAttachmentMetaDataAsyncWithHttpInfo($email_id, $attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttachmentMetaDataAsyncWithHttpInfo + * + * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttachmentMetaDataAsyncWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0]) + { + $returnType = '\MailSlurp\Models\AttachmentMetaData'; + $request = $this->getAttachmentMetaDataRequest($email_id, $attachment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAttachmentMetaData' + * + * @param string $email_id ID of email (required) + * @param string $attachment_id ID of attachment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAttachmentMetaDataRequest($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getAttachmentMetaData' + ); + } + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling getAttachmentMetaData' + ); + } + + + $resourcePath = '/emails/{emailId}/attachments/{attachmentId}/metadata'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachmentId' . '}', + ObjectSerializer::toPathValue($attachment_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmail + * + * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. + * + * @param string $email_id email_id (required) + * @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function getEmail($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0]) + { + list($response) = $this->getEmailWithHttpInfo($email_id, $decode, $contentType); + return $response; + } + + /** + * Operation getEmailWithHttpInfo + * + * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. + * + * @param string $email_id (required) + * @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0]) + { + $request = $this->getEmailRequest($email_id, $decode, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailAsync + * + * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. + * + * @param string $email_id (required) + * @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailAsync($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0]) + { + return $this->getEmailAsyncWithHttpInfo($email_id, $decode, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailAsyncWithHttpInfo + * + * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. + * + * @param string $email_id (required) + * @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailAsyncWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->getEmailRequest($email_id, $decode, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmail' + * + * @param string $email_id (required) + * @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailRequest($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmail' + ); + } + + + + $resourcePath = '/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $decode, + 'decode', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailAttachments + * + * Get all email attachment metadata. Metadata includes name and size of attachments. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AttachmentMetaData[] + */ + public function getEmailAttachments($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0]) + { + list($response) = $this->getEmailAttachmentsWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getEmailAttachmentsWithHttpInfo + * + * Get all email attachment metadata. Metadata includes name and size of attachments. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AttachmentMetaData[], HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailAttachmentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0]) + { + $request = $this->getEmailAttachmentsRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AttachmentMetaData[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AttachmentMetaData[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AttachmentMetaData[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AttachmentMetaData[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailAttachmentsAsync + * + * Get all email attachment metadata. Metadata includes name and size of attachments. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailAttachmentsAsync($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0]) + { + return $this->getEmailAttachmentsAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailAttachmentsAsyncWithHttpInfo + * + * Get all email attachment metadata. Metadata includes name and size of attachments. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailAttachmentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0]) + { + $returnType = '\MailSlurp\Models\AttachmentMetaData[]'; + $request = $this->getEmailAttachmentsRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailAttachments' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailAttachmentsRequest($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailAttachments' + ); + } + + + $resourcePath = '/emails/{emailId}/attachments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailContentMatch + * + * Get email content regex pattern match results. Runs regex against email body and returns match groups. + * + * @param string $email_id ID of email to match against (required) + * @param \MailSlurp\Models\ContentMatchOptions $content_match_options content_match_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailContentMatchResult + */ + public function getEmailContentMatch($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0]) + { + list($response) = $this->getEmailContentMatchWithHttpInfo($email_id, $content_match_options, $contentType); + return $response; + } + + /** + * Operation getEmailContentMatchWithHttpInfo + * + * Get email content regex pattern match results. Runs regex against email body and returns match groups. + * + * @param string $email_id ID of email to match against (required) + * @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailContentMatchResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailContentMatchWithHttpInfo($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0]) + { + $request = $this->getEmailContentMatchRequest($email_id, $content_match_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailContentMatchResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailContentMatchResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailContentMatchResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailContentMatchResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailContentMatchResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailContentMatchAsync + * + * Get email content regex pattern match results. Runs regex against email body and returns match groups. + * + * @param string $email_id ID of email to match against (required) + * @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailContentMatchAsync($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0]) + { + return $this->getEmailContentMatchAsyncWithHttpInfo($email_id, $content_match_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailContentMatchAsyncWithHttpInfo + * + * Get email content regex pattern match results. Runs regex against email body and returns match groups. + * + * @param string $email_id ID of email to match against (required) + * @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailContentMatchAsyncWithHttpInfo($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0]) + { + $returnType = '\MailSlurp\Models\EmailContentMatchResult'; + $request = $this->getEmailContentMatchRequest($email_id, $content_match_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailContentMatch' + * + * @param string $email_id ID of email to match against (required) + * @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailContentMatchRequest($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailContentMatch' + ); + } + + // verify the required parameter 'content_match_options' is set + if ($content_match_options === null || (is_array($content_match_options) && count($content_match_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $content_match_options when calling getEmailContentMatch' + ); + } + + + $resourcePath = '/emails/{emailId}/contentMatch'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($content_match_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($content_match_options)); + } else { + $httpBody = $content_match_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailCount + * + * Get email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\CountDto + */ + public function getEmailCount(string $contentType = self::contentTypes['getEmailCount'][0]) + { + list($response) = $this->getEmailCountWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getEmailCountWithHttpInfo + * + * Get email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailCountWithHttpInfo(string $contentType = self::contentTypes['getEmailCount'][0]) + { + $request = $this->getEmailCountRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\CountDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\CountDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\CountDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\CountDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailCountAsync + * + * Get email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailCountAsync(string $contentType = self::contentTypes['getEmailCount'][0]) + { + return $this->getEmailCountAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailCountAsyncWithHttpInfo + * + * Get email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getEmailCount'][0]) + { + $returnType = '\MailSlurp\Models\CountDto'; + $request = $this->getEmailCountRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailCount' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailCountRequest(string $contentType = self::contentTypes['getEmailCount'][0]) + { + + + $resourcePath = '/emails/emails/count'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailHTML + * + * Get email content as HTML. For displaying emails in browser context. + * + * @param string $email_id email_id (required) + * @param bool $decode decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getEmailHTML($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTML'][0]) + { + list($response) = $this->getEmailHTMLWithHttpInfo($email_id, $decode, $contentType); + return $response; + } + + /** + * Operation getEmailHTMLWithHttpInfo + * + * Get email content as HTML. For displaying emails in browser context. + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailHTMLWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTML'][0]) + { + $request = $this->getEmailHTMLRequest($email_id, $decode, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailHTMLAsync + * + * Get email content as HTML. For displaying emails in browser context. + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLAsync($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTML'][0]) + { + return $this->getEmailHTMLAsyncWithHttpInfo($email_id, $decode, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailHTMLAsyncWithHttpInfo + * + * Get email content as HTML. For displaying emails in browser context. + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLAsyncWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTML'][0]) + { + $returnType = 'string'; + $request = $this->getEmailHTMLRequest($email_id, $decode, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailHTML' + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailHTMLRequest($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTML'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailHTML' + ); + } + + + + $resourcePath = '/emails/{emailId}/html'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $decode, + 'decode', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/html;charset=utf-8', 'text/html', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailHTMLJson + * + * Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content + * + * @param string $email_id email_id (required) + * @param bool $decode decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailHtmlDto + */ + public function getEmailHTMLJson($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0]) + { + list($response) = $this->getEmailHTMLJsonWithHttpInfo($email_id, $decode, $contentType); + return $response; + } + + /** + * Operation getEmailHTMLJsonWithHttpInfo + * + * Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailHtmlDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailHTMLJsonWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0]) + { + $request = $this->getEmailHTMLJsonRequest($email_id, $decode, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailHtmlDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailHtmlDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailHtmlDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailHtmlDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailHtmlDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailHTMLJsonAsync + * + * Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLJsonAsync($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0]) + { + return $this->getEmailHTMLJsonAsyncWithHttpInfo($email_id, $decode, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailHTMLJsonAsyncWithHttpInfo + * + * Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLJsonAsyncWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0]) + { + $returnType = '\MailSlurp\Models\EmailHtmlDto'; + $request = $this->getEmailHTMLJsonRequest($email_id, $decode, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailHTMLJson' + * + * @param string $email_id (required) + * @param bool $decode (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailHTMLJsonRequest($email_id, $decode = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailHTMLJson' + ); + } + + + + $resourcePath = '/emails/{emailId}/html/json'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $decode, + 'decode', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailHTMLQuery + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to perform HTML query on (required) + * @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailTextLinesResult + */ + public function getEmailHTMLQuery($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0]) + { + list($response) = $this->getEmailHTMLQueryWithHttpInfo($email_id, $html_selector, $contentType); + return $response; + } + + /** + * Operation getEmailHTMLQueryWithHttpInfo + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to perform HTML query on (required) + * @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailTextLinesResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailHTMLQueryWithHttpInfo($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0]) + { + $request = $this->getEmailHTMLQueryRequest($email_id, $html_selector, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailTextLinesResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailTextLinesResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailTextLinesResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailTextLinesResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailTextLinesResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailHTMLQueryAsync + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to perform HTML query on (required) + * @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLQueryAsync($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0]) + { + return $this->getEmailHTMLQueryAsyncWithHttpInfo($email_id, $html_selector, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailHTMLQueryAsyncWithHttpInfo + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to perform HTML query on (required) + * @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailHTMLQueryAsyncWithHttpInfo($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0]) + { + $returnType = '\MailSlurp\Models\EmailTextLinesResult'; + $request = $this->getEmailHTMLQueryRequest($email_id, $html_selector, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailHTMLQuery' + * + * @param string $email_id ID of email to perform HTML query on (required) + * @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailHTMLQueryRequest($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailHTMLQuery' + ); + } + + // verify the required parameter 'html_selector' is set + if ($html_selector === null || (is_array($html_selector) && count($html_selector) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $html_selector when calling getEmailHTMLQuery' + ); + } + + + $resourcePath = '/emails/{emailId}/htmlQuery'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $html_selector, + 'htmlSelector', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailLinks + * + * Parse and return list of links found in an email (only works for HTML content) + * + * @param string $email_id ID of email to fetch text for (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailLinksResult + */ + public function getEmailLinks($email_id, string $contentType = self::contentTypes['getEmailLinks'][0]) + { + list($response) = $this->getEmailLinksWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getEmailLinksWithHttpInfo + * + * Parse and return list of links found in an email (only works for HTML content) + * + * @param string $email_id ID of email to fetch text for (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailLinksResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailLinksWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailLinks'][0]) + { + $request = $this->getEmailLinksRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailLinksResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailLinksResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailLinksResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailLinksResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailLinksResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailLinksAsync + * + * Parse and return list of links found in an email (only works for HTML content) + * + * @param string $email_id ID of email to fetch text for (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailLinksAsync($email_id, string $contentType = self::contentTypes['getEmailLinks'][0]) + { + return $this->getEmailLinksAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailLinksAsyncWithHttpInfo + * + * Parse and return list of links found in an email (only works for HTML content) + * + * @param string $email_id ID of email to fetch text for (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailLinksAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailLinks'][0]) + { + $returnType = '\MailSlurp\Models\EmailLinksResult'; + $request = $this->getEmailLinksRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailLinks' + * + * @param string $email_id ID of email to fetch text for (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailLinksRequest($email_id, string $contentType = self::contentTypes['getEmailLinks'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailLinks' + ); + } + + + $resourcePath = '/emails/{emailId}/links'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailPreviewURLs + * + * Get email URLs for viewing in browser or downloading + * + * @param string $email_id email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreviewUrls + */ + public function getEmailPreviewURLs($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0]) + { + list($response) = $this->getEmailPreviewURLsWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getEmailPreviewURLsWithHttpInfo + * + * Get email URLs for viewing in browser or downloading + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreviewUrls, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailPreviewURLsWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0]) + { + $request = $this->getEmailPreviewURLsRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreviewUrls' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreviewUrls' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreviewUrls', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreviewUrls'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreviewUrls', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailPreviewURLsAsync + * + * Get email URLs for viewing in browser or downloading + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailPreviewURLsAsync($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0]) + { + return $this->getEmailPreviewURLsAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailPreviewURLsAsyncWithHttpInfo + * + * Get email URLs for viewing in browser or downloading + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailPreviewURLsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreviewUrls'; + $request = $this->getEmailPreviewURLsRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailPreviewURLs' + * + * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailPreviewURLsRequest($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailPreviewURLs' + ); + } + + + $resourcePath = '/emails/{emailId}/urls'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailTextLines + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to fetch text for (required) + * @param bool $decode_html_entities Decode HTML entities (optional) + * @param string $line_separator Line separator character (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailTextLinesResult + */ + public function getEmailTextLines($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0]) + { + list($response) = $this->getEmailTextLinesWithHttpInfo($email_id, $decode_html_entities, $line_separator, $contentType); + return $response; + } + + /** + * Operation getEmailTextLinesWithHttpInfo + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to fetch text for (required) + * @param bool $decode_html_entities Decode HTML entities (optional) + * @param string $line_separator Line separator character (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailTextLinesResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailTextLinesWithHttpInfo($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0]) + { + $request = $this->getEmailTextLinesRequest($email_id, $decode_html_entities, $line_separator, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailTextLinesResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailTextLinesResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailTextLinesResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailTextLinesResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailTextLinesResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailTextLinesAsync + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to fetch text for (required) + * @param bool $decode_html_entities Decode HTML entities (optional) + * @param string $line_separator Line separator character (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailTextLinesAsync($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0]) + { + return $this->getEmailTextLinesAsyncWithHttpInfo($email_id, $decode_html_entities, $line_separator, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailTextLinesAsyncWithHttpInfo + * + * Parse and return text from an email, stripping HTML and decoding encoded characters + * + * @param string $email_id ID of email to fetch text for (required) + * @param bool $decode_html_entities Decode HTML entities (optional) + * @param string $line_separator Line separator character (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailTextLinesAsyncWithHttpInfo($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0]) + { + $returnType = '\MailSlurp\Models\EmailTextLinesResult'; + $request = $this->getEmailTextLinesRequest($email_id, $decode_html_entities, $line_separator, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailTextLines' + * + * @param string $email_id ID of email to fetch text for (required) + * @param bool $decode_html_entities Decode HTML entities (optional) + * @param string $line_separator Line separator character (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailTextLinesRequest($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getEmailTextLines' + ); + } + + + + + $resourcePath = '/emails/{emailId}/textLines'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $decode_html_entities, + 'decodeHtmlEntities', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $line_separator, + 'lineSeparator', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmailsPaginated + * + * Get all emails in all inboxes in paginated form. Email API list all. + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageEmailProjection + */ + public function getEmailsPaginated($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0]) + { + list($response) = $this->getEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getEmailsPaginatedWithHttpInfo + * + * Get all emails in all inboxes in paginated form. Email API list all. + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailsPaginatedWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0]) + { + $request = $this->getEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailsPaginatedAsync + * + * Get all emails in all inboxes in paginated form. Email API list all. + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsPaginatedAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0]) + { + return $this->getEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailsPaginatedAsyncWithHttpInfo + * + * Get all emails in all inboxes in paginated form. Email API list all. + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsPaginatedAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageEmailProjection'; + $request = $this->getEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmailsPaginated' + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailsPaginatedRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0]) + { + + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EmailControllerApi.getEmailsPaginated, must be smaller than or equal to 100.'); + } + + + + + + + + $resourcePath = '/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGravatarUrlForEmailAddress + * + * @param string $email_address email_address (required) + * @param string $size size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GravatarUrl + */ + public function getGravatarUrlForEmailAddress($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0]) + { + list($response) = $this->getGravatarUrlForEmailAddressWithHttpInfo($email_address, $size, $contentType); + return $response; + } + + /** + * Operation getGravatarUrlForEmailAddressWithHttpInfo + * + * @param string $email_address (required) + * @param string $size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GravatarUrl, HTTP status code, HTTP response headers (array of strings) + */ + public function getGravatarUrlForEmailAddressWithHttpInfo($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0]) + { + $request = $this->getGravatarUrlForEmailAddressRequest($email_address, $size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GravatarUrl' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GravatarUrl' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GravatarUrl', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GravatarUrl'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GravatarUrl', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getGravatarUrlForEmailAddressAsync + * + * @param string $email_address (required) + * @param string $size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGravatarUrlForEmailAddressAsync($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0]) + { + return $this->getGravatarUrlForEmailAddressAsyncWithHttpInfo($email_address, $size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGravatarUrlForEmailAddressAsyncWithHttpInfo + * + * @param string $email_address (required) + * @param string $size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGravatarUrlForEmailAddressAsyncWithHttpInfo($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0]) + { + $returnType = '\MailSlurp\Models\GravatarUrl'; + $request = $this->getGravatarUrlForEmailAddressRequest($email_address, $size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGravatarUrlForEmailAddress' + * + * @param string $email_address (required) + * @param string $size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGravatarUrlForEmailAddressRequest($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0]) + { + + // verify the required parameter 'email_address' is set + if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_address when calling getGravatarUrlForEmailAddress' + ); + } + + + + $resourcePath = '/emails/gravatarFor'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLatestEmail + * + * Get latest email in all inboxes. Most recently received. + * + * @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function getLatestEmail($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0]) + { + list($response) = $this->getLatestEmailWithHttpInfo($inbox_ids, $contentType); + return $response; + } + + /** + * Operation getLatestEmailWithHttpInfo + * + * Get latest email in all inboxes. Most recently received. + * + * @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function getLatestEmailWithHttpInfo($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0]) + { + $request = $this->getLatestEmailRequest($inbox_ids, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLatestEmailAsync + * + * Get latest email in all inboxes. Most recently received. + * + * @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailAsync($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0]) + { + return $this->getLatestEmailAsyncWithHttpInfo($inbox_ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLatestEmailAsyncWithHttpInfo + * + * Get latest email in all inboxes. Most recently received. + * + * @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailAsyncWithHttpInfo($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->getLatestEmailRequest($inbox_ids, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLatestEmail' + * + * @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLatestEmailRequest($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0]) + { + + + + $resourcePath = '/emails/latest'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_ids, + 'inboxIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLatestEmailInInbox1 + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function getLatestEmailInInbox1($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0]) + { + list($response) = $this->getLatestEmailInInbox1WithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getLatestEmailInInbox1WithHttpInfo + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function getLatestEmailInInbox1WithHttpInfo($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0]) + { + $request = $this->getLatestEmailInInbox1Request($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLatestEmailInInbox1Async + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailInInbox1Async($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0]) + { + return $this->getLatestEmailInInbox1AsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLatestEmailInInbox1AsyncWithHttpInfo + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailInInbox1AsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->getLatestEmailInInbox1Request($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLatestEmailInInbox1' + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLatestEmailInInbox1Request($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getLatestEmailInInbox1' + ); + } + + + $resourcePath = '/emails/latestIn'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOrganizationEmailsPaginated + * + * Get all organization emails. List team or shared test email accounts + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter search filter for emails. (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageEmailProjection + */ + public function getOrganizationEmailsPaginated($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0]) + { + list($response) = $this->getOrganizationEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getOrganizationEmailsPaginatedWithHttpInfo + * + * Get all organization emails. List team or shared test email accounts + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter search filter for emails. (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationEmailsPaginatedWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0]) + { + $request = $this->getOrganizationEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationEmailsPaginatedAsync + * + * Get all organization emails. List team or shared test email accounts + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter search filter for emails. (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationEmailsPaginatedAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0]) + { + return $this->getOrganizationEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationEmailsPaginatedAsyncWithHttpInfo + * + * Get all organization emails. List team or shared test email accounts + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter search filter for emails. (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationEmailsPaginatedAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageEmailProjection'; + $request = $this->getOrganizationEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOrganizationEmailsPaginated' + * + * @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional) + * @param int $page Optional page index in email list pagination (optional, default to 0) + * @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param string $search_filter Optional search filter search filter for emails. (optional) + * @param \DateTime $since Optional filter emails received after given date time (optional) + * @param \DateTime $before Optional filter emails received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOrganizationEmailsPaginatedRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0]) + { + + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EmailControllerApi.getOrganizationEmailsPaginated, must be smaller than or equal to 100.'); + } + + + + + + + + $resourcePath = '/emails/organization'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRawEmailContents + * + * Get raw email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getRawEmailContents($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0]) + { + list($response) = $this->getRawEmailContentsWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getRawEmailContentsWithHttpInfo + * + * Get raw email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getRawEmailContentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0]) + { + $request = $this->getRawEmailContentsRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRawEmailContentsAsync + * + * Get raw email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawEmailContentsAsync($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0]) + { + return $this->getRawEmailContentsAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRawEmailContentsAsyncWithHttpInfo + * + * Get raw email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawEmailContentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0]) + { + $returnType = 'string'; + $request = $this->getRawEmailContentsRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRawEmailContents' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRawEmailContentsRequest($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRawEmailContents' + ); + } + + + $resourcePath = '/emails/{emailId}/raw'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRawEmailJson + * + * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\RawEmailJson + */ + public function getRawEmailJson($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0]) + { + list($response) = $this->getRawEmailJsonWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getRawEmailJsonWithHttpInfo + * + * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\RawEmailJson, HTTP status code, HTTP response headers (array of strings) + */ + public function getRawEmailJsonWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0]) + { + $request = $this->getRawEmailJsonRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\RawEmailJson' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\RawEmailJson' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\RawEmailJson', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\RawEmailJson'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\RawEmailJson', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRawEmailJsonAsync + * + * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawEmailJsonAsync($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0]) + { + return $this->getRawEmailJsonAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRawEmailJsonAsyncWithHttpInfo + * + * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawEmailJsonAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0]) + { + $returnType = '\MailSlurp\Models\RawEmailJson'; + $request = $this->getRawEmailJsonRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRawEmailJson' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRawEmailJsonRequest($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRawEmailJson' + ); + } + + + $resourcePath = '/emails/{emailId}/raw/json'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUnreadEmailCount + * + * Get unread email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\UnreadCount + */ + public function getUnreadEmailCount(string $contentType = self::contentTypes['getUnreadEmailCount'][0]) + { + list($response) = $this->getUnreadEmailCountWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getUnreadEmailCountWithHttpInfo + * + * Get unread email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\UnreadCount, HTTP status code, HTTP response headers (array of strings) + */ + public function getUnreadEmailCountWithHttpInfo(string $contentType = self::contentTypes['getUnreadEmailCount'][0]) + { + $request = $this->getUnreadEmailCountRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\UnreadCount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\UnreadCount' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\UnreadCount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\UnreadCount'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\UnreadCount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getUnreadEmailCountAsync + * + * Get unread email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUnreadEmailCountAsync(string $contentType = self::contentTypes['getUnreadEmailCount'][0]) + { + return $this->getUnreadEmailCountAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUnreadEmailCountAsyncWithHttpInfo + * + * Get unread email count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUnreadEmailCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getUnreadEmailCount'][0]) + { + $returnType = '\MailSlurp\Models\UnreadCount'; + $request = $this->getUnreadEmailCountRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUnreadEmailCount' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUnreadEmailCountRequest(string $contentType = self::contentTypes['getUnreadEmailCount'][0]) + { + + + $resourcePath = '/emails/unreadCount'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation markAsRead + * + * Mark an email as read on unread + * + * @param string $email_id email_id (required) + * @param bool $read What value to assign to email read property. Default true. (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview + */ + public function markAsRead($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0]) + { + list($response) = $this->markAsReadWithHttpInfo($email_id, $read, $contentType); + return $response; + } + + /** + * Operation markAsReadWithHttpInfo + * + * Mark an email as read on unread + * + * @param string $email_id (required) + * @param bool $read What value to assign to email read property. Default true. (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview, HTTP status code, HTTP response headers (array of strings) + */ + public function markAsReadWithHttpInfo($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0]) + { + $request = $this->markAsReadRequest($email_id, $read, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation markAsReadAsync + * + * Mark an email as read on unread + * + * @param string $email_id (required) + * @param bool $read What value to assign to email read property. Default true. (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function markAsReadAsync($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0]) + { + return $this->markAsReadAsyncWithHttpInfo($email_id, $read, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation markAsReadAsyncWithHttpInfo + * + * Mark an email as read on unread + * + * @param string $email_id (required) + * @param bool $read What value to assign to email read property. Default true. (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function markAsReadAsyncWithHttpInfo($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview'; + $request = $this->markAsReadRequest($email_id, $read, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'markAsRead' + * + * @param string $email_id (required) + * @param bool $read What value to assign to email read property. Default true. (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function markAsReadRequest($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling markAsRead' + ); + } + + + + $resourcePath = '/emails/{emailId}/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $read, + 'read', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation replyToEmail + * + * Reply to an email + * + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options reply_to_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function replyToEmail($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0]) + { + list($response) = $this->replyToEmailWithHttpInfo($email_id, $reply_to_email_options, $contentType); + return $response; + } + + /** + * Operation replyToEmailWithHttpInfo + * + * Reply to an email + * + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function replyToEmailWithHttpInfo($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0]) + { + $request = $this->replyToEmailRequest($email_id, $reply_to_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation replyToEmailAsync + * + * Reply to an email + * + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replyToEmailAsync($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0]) + { + return $this->replyToEmailAsyncWithHttpInfo($email_id, $reply_to_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation replyToEmailAsyncWithHttpInfo + * + * Reply to an email + * + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replyToEmailAsyncWithHttpInfo($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->replyToEmailRequest($email_id, $reply_to_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'replyToEmail' + * + * @param string $email_id ID of the email that should be replied to (required) + * @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function replyToEmailRequest($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling replyToEmail' + ); + } + + // verify the required parameter 'reply_to_email_options' is set + if ($reply_to_email_options === null || (is_array($reply_to_email_options) && count($reply_to_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $reply_to_email_options when calling replyToEmail' + ); + } + + + $resourcePath = '/emails/{emailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($reply_to_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($reply_to_email_options)); + } else { + $httpBody = $reply_to_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendEmailSourceOptional + * + * Send email + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param string $inbox_id ID of the inbox you want to send the email from (optional) + * @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional) + * @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendEmailSourceOptional($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0]) + { + $this->sendEmailSourceOptionalWithHttpInfo($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType); + } + + /** + * Operation sendEmailSourceOptionalWithHttpInfo + * + * Send email + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $inbox_id ID of the inbox you want to send the email from (optional) + * @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional) + * @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailSourceOptionalWithHttpInfo($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0]) + { + $request = $this->sendEmailSourceOptionalRequest($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation sendEmailSourceOptionalAsync + * + * Send email + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $inbox_id ID of the inbox you want to send the email from (optional) + * @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional) + * @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailSourceOptionalAsync($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0]) + { + return $this->sendEmailSourceOptionalAsyncWithHttpInfo($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendEmailSourceOptionalAsyncWithHttpInfo + * + * Send email + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $inbox_id ID of the inbox you want to send the email from (optional) + * @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional) + * @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailSourceOptionalAsyncWithHttpInfo($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0]) + { + $returnType = ''; + $request = $this->sendEmailSourceOptionalRequest($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendEmailSourceOptional' + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $inbox_id ID of the inbox you want to send the email from (optional) + * @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional) + * @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendEmailSourceOptionalRequest($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0]) + { + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendEmailSourceOptional' + ); + } + + + + + + $resourcePath = '/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_domain_pool, + 'useDomainPool', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $virtual_send, + 'virtualSend', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation validateEmail + * + * Validate email HTML contents + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ValidationDto + */ + public function validateEmail($email_id, string $contentType = self::contentTypes['validateEmail'][0]) + { + list($response) = $this->validateEmailWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation validateEmailWithHttpInfo + * + * Validate email HTML contents + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ValidationDto, HTTP status code, HTTP response headers (array of strings) + */ + public function validateEmailWithHttpInfo($email_id, string $contentType = self::contentTypes['validateEmail'][0]) + { + $request = $this->validateEmailRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\ValidationDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ValidationDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ValidationDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ValidationDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ValidationDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation validateEmailAsync + * + * Validate email HTML contents + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateEmailAsync($email_id, string $contentType = self::contentTypes['validateEmail'][0]) + { + return $this->validateEmailAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateEmailAsyncWithHttpInfo + * + * Validate email HTML contents + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateEmailAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['validateEmail'][0]) + { + $returnType = '\MailSlurp\Models\ValidationDto'; + $request = $this->validateEmailRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'validateEmail' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function validateEmailRequest($email_id, string $contentType = self::contentTypes['validateEmail'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling validateEmail' + ); + } + + + $resourcePath = '/emails/{emailId}/validate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/EmailVerificationControllerApi.php b/lib/Apis/EmailVerificationControllerApi.php new file mode 100644 index 00000000..a27135a4 --- /dev/null +++ b/lib/Apis/EmailVerificationControllerApi.php @@ -0,0 +1,819 @@ + [ + 'application/json', + ], + 'validateEmailAddressList' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getValidationRequests + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $is_valid Filter where email is valid is true or false (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageEmailValidationRequest + */ + public function getValidationRequests($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0]) + { + list($response) = $this->getValidationRequestsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType); + return $response; + } + + /** + * Operation getValidationRequestsWithHttpInfo + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $is_valid Filter where email is valid is true or false (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageEmailValidationRequest, HTTP status code, HTTP response headers (array of strings) + */ + public function getValidationRequestsWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0]) + { + $request = $this->getValidationRequestsRequest($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageEmailValidationRequest' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageEmailValidationRequest' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailValidationRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageEmailValidationRequest'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageEmailValidationRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getValidationRequestsAsync + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $is_valid Filter where email is valid is true or false (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getValidationRequestsAsync($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0]) + { + return $this->getValidationRequestsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getValidationRequestsAsyncWithHttpInfo + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $is_valid Filter where email is valid is true or false (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getValidationRequestsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0]) + { + $returnType = '\MailSlurp\Models\PageEmailValidationRequest'; + $request = $this->getValidationRequestsRequest($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getValidationRequests' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $is_valid Filter where email is valid is true or false (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getValidationRequestsRequest($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0]) + { + + if ($page !== null && $page > 9223372036854775807) { + throw new \InvalidArgumentException('invalid value for "$page" when calling EmailVerificationControllerApi.getValidationRequests, must be smaller than or equal to 9223372036854775807.'); + } + if ($page !== null && $page < 0) { + throw new \InvalidArgumentException('invalid value for "$page" when calling EmailVerificationControllerApi.getValidationRequests, must be bigger than or equal to 0.'); + } + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EmailVerificationControllerApi.getValidationRequests, must be smaller than or equal to 100.'); + } + if ($size !== null && $size < 1) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EmailVerificationControllerApi.getValidationRequests, must be bigger than or equal to 1.'); + } + + + + + + + + $resourcePath = '/email-verification/validation-requests'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $is_valid, + 'isValid', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation validateEmailAddressList + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options validate_email_address_list_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ValidateEmailAddressListResult + */ + public function validateEmailAddressList($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0]) + { + list($response) = $this->validateEmailAddressListWithHttpInfo($validate_email_address_list_options, $contentType); + return $response; + } + + /** + * Operation validateEmailAddressListWithHttpInfo + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ValidateEmailAddressListResult, HTTP status code, HTTP response headers (array of strings) + */ + public function validateEmailAddressListWithHttpInfo($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0]) + { + $request = $this->validateEmailAddressListRequest($validate_email_address_list_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ValidateEmailAddressListResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ValidateEmailAddressListResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ValidateEmailAddressListResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ValidateEmailAddressListResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ValidateEmailAddressListResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation validateEmailAddressListAsync + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateEmailAddressListAsync($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0]) + { + return $this->validateEmailAddressListAsyncWithHttpInfo($validate_email_address_list_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateEmailAddressListAsyncWithHttpInfo + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing. + * + * @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateEmailAddressListAsyncWithHttpInfo($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0]) + { + $returnType = '\MailSlurp\Models\ValidateEmailAddressListResult'; + $request = $this->validateEmailAddressListRequest($validate_email_address_list_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'validateEmailAddressList' + * + * @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function validateEmailAddressListRequest($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0]) + { + + // verify the required parameter 'validate_email_address_list_options' is set + if ($validate_email_address_list_options === null || (is_array($validate_email_address_list_options) && count($validate_email_address_list_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validate_email_address_list_options when calling validateEmailAddressList' + ); + } + + + $resourcePath = '/email-verification/email-address-list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validate_email_address_list_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($validate_email_address_list_options)); + } else { + $httpBody = $validate_email_address_list_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/ExpiredControllerApi.php b/lib/Apis/ExpiredControllerApi.php new file mode 100644 index 00000000..baf61cd8 --- /dev/null +++ b/lib/Apis/ExpiredControllerApi.php @@ -0,0 +1,1340 @@ + [ + 'application/json', + ], + 'getExpiredInboxByInboxId' => [ + 'application/json', + ], + 'getExpiredInboxRecord' => [ + 'application/json', + ], + 'getExpiredInboxes' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getExpirationDefaults + * + * Get default expiration settings + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ExpirationDefaults + */ + public function getExpirationDefaults(string $contentType = self::contentTypes['getExpirationDefaults'][0]) + { + list($response) = $this->getExpirationDefaultsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getExpirationDefaultsWithHttpInfo + * + * Get default expiration settings + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ExpirationDefaults, HTTP status code, HTTP response headers (array of strings) + */ + public function getExpirationDefaultsWithHttpInfo(string $contentType = self::contentTypes['getExpirationDefaults'][0]) + { + $request = $this->getExpirationDefaultsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ExpirationDefaults' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ExpirationDefaults' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpirationDefaults', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ExpirationDefaults'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ExpirationDefaults', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExpirationDefaultsAsync + * + * Get default expiration settings + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpirationDefaultsAsync(string $contentType = self::contentTypes['getExpirationDefaults'][0]) + { + return $this->getExpirationDefaultsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExpirationDefaultsAsyncWithHttpInfo + * + * Get default expiration settings + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpirationDefaultsAsyncWithHttpInfo(string $contentType = self::contentTypes['getExpirationDefaults'][0]) + { + $returnType = '\MailSlurp\Models\ExpirationDefaults'; + $request = $this->getExpirationDefaultsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getExpirationDefaults' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExpirationDefaultsRequest(string $contentType = self::contentTypes['getExpirationDefaults'][0]) + { + + + $resourcePath = '/expired/defaults'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getExpiredInboxByInboxId + * + * Get expired inbox record for a previously existing inbox + * + * @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ExpiredInboxDto + */ + public function getExpiredInboxByInboxId($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0]) + { + list($response) = $this->getExpiredInboxByInboxIdWithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getExpiredInboxByInboxIdWithHttpInfo + * + * Get expired inbox record for a previously existing inbox + * + * @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ExpiredInboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getExpiredInboxByInboxIdWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0]) + { + $request = $this->getExpiredInboxByInboxIdRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ExpiredInboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ExpiredInboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpiredInboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ExpiredInboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ExpiredInboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExpiredInboxByInboxIdAsync + * + * Get expired inbox record for a previously existing inbox + * + * @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxByInboxIdAsync($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0]) + { + return $this->getExpiredInboxByInboxIdAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExpiredInboxByInboxIdAsyncWithHttpInfo + * + * Get expired inbox record for a previously existing inbox + * + * @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxByInboxIdAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0]) + { + $returnType = '\MailSlurp\Models\ExpiredInboxDto'; + $request = $this->getExpiredInboxByInboxIdRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getExpiredInboxByInboxId' + * + * @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExpiredInboxByInboxIdRequest($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getExpiredInboxByInboxId' + ); + } + + + $resourcePath = '/expired/inbox/{inboxId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getExpiredInboxRecord + * + * Get an expired inbox record + * + * @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ExpiredInboxDto + */ + public function getExpiredInboxRecord($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0]) + { + list($response) = $this->getExpiredInboxRecordWithHttpInfo($expired_id, $contentType); + return $response; + } + + /** + * Operation getExpiredInboxRecordWithHttpInfo + * + * Get an expired inbox record + * + * @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ExpiredInboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getExpiredInboxRecordWithHttpInfo($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0]) + { + $request = $this->getExpiredInboxRecordRequest($expired_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ExpiredInboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ExpiredInboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpiredInboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ExpiredInboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ExpiredInboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExpiredInboxRecordAsync + * + * Get an expired inbox record + * + * @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxRecordAsync($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0]) + { + return $this->getExpiredInboxRecordAsyncWithHttpInfo($expired_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExpiredInboxRecordAsyncWithHttpInfo + * + * Get an expired inbox record + * + * @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxRecordAsyncWithHttpInfo($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0]) + { + $returnType = '\MailSlurp\Models\ExpiredInboxDto'; + $request = $this->getExpiredInboxRecordRequest($expired_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getExpiredInboxRecord' + * + * @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExpiredInboxRecordRequest($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0]) + { + + // verify the required parameter 'expired_id' is set + if ($expired_id === null || (is_array($expired_id) && count($expired_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $expired_id when calling getExpiredInboxRecord' + ); + } + + + $resourcePath = '/expired/{expiredId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($expired_id !== null) { + $resourcePath = str_replace( + '{' . 'expiredId' . '}', + ObjectSerializer::toPathValue($expired_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getExpiredInboxes + * + * List records of expired inboxes + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageExpiredInboxRecordProjection + */ + public function getExpiredInboxes($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0]) + { + list($response) = $this->getExpiredInboxesWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getExpiredInboxesWithHttpInfo + * + * List records of expired inboxes + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageExpiredInboxRecordProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getExpiredInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0]) + { + $request = $this->getExpiredInboxesRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageExpiredInboxRecordProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageExpiredInboxRecordProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageExpiredInboxRecordProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageExpiredInboxRecordProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageExpiredInboxRecordProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExpiredInboxesAsync + * + * List records of expired inboxes + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0]) + { + return $this->getExpiredInboxesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExpiredInboxesAsyncWithHttpInfo + * + * List records of expired inboxes + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExpiredInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0]) + { + $returnType = '\MailSlurp\Models\PageExpiredInboxRecordProjection'; + $request = $this->getExpiredInboxesRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getExpiredInboxes' + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExpiredInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0]) + { + + + + + + + + $resourcePath = '/expired'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/ExportControllerApi.php b/lib/Apis/ExportControllerApi.php new file mode 100644 index 00000000..d0c3aaf3 --- /dev/null +++ b/lib/Apis/ExportControllerApi.php @@ -0,0 +1,876 @@ + [ + 'application/json', + ], + 'getExportLink' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation exportEntities + * + * Export inboxes link callable via browser + * + * @param string $export_type export_type (required) + * @param string $api_key api_key (required) + * @param string $output_format output_format (required) + * @param string $filter filter (optional) + * @param string $list_separator_token list_separator_token (optional) + * @param bool $exclude_previously_exported exclude_previously_exported (optional) + * @param \DateTime $created_earliest_time created_earliest_time (optional) + * @param \DateTime $created_oldest_time created_oldest_time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function exportEntities($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0]) + { + list($response) = $this->exportEntitiesWithHttpInfo($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType); + return $response; + } + + /** + * Operation exportEntitiesWithHttpInfo + * + * Export inboxes link callable via browser + * + * @param string $export_type (required) + * @param string $api_key (required) + * @param string $output_format (required) + * @param string $filter (optional) + * @param string $list_separator_token (optional) + * @param bool $exclude_previously_exported (optional) + * @param \DateTime $created_earliest_time (optional) + * @param \DateTime $created_oldest_time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function exportEntitiesWithHttpInfo($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0]) + { + $request = $this->exportEntitiesRequest($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation exportEntitiesAsync + * + * Export inboxes link callable via browser + * + * @param string $export_type (required) + * @param string $api_key (required) + * @param string $output_format (required) + * @param string $filter (optional) + * @param string $list_separator_token (optional) + * @param bool $exclude_previously_exported (optional) + * @param \DateTime $created_earliest_time (optional) + * @param \DateTime $created_oldest_time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportEntitiesAsync($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0]) + { + return $this->exportEntitiesAsyncWithHttpInfo($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportEntitiesAsyncWithHttpInfo + * + * Export inboxes link callable via browser + * + * @param string $export_type (required) + * @param string $api_key (required) + * @param string $output_format (required) + * @param string $filter (optional) + * @param string $list_separator_token (optional) + * @param bool $exclude_previously_exported (optional) + * @param \DateTime $created_earliest_time (optional) + * @param \DateTime $created_oldest_time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportEntitiesAsyncWithHttpInfo($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0]) + { + $returnType = 'string[]'; + $request = $this->exportEntitiesRequest($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'exportEntities' + * + * @param string $export_type (required) + * @param string $api_key (required) + * @param string $output_format (required) + * @param string $filter (optional) + * @param string $list_separator_token (optional) + * @param bool $exclude_previously_exported (optional) + * @param \DateTime $created_earliest_time (optional) + * @param \DateTime $created_oldest_time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportEntitiesRequest($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0]) + { + + // verify the required parameter 'export_type' is set + if ($export_type === null || (is_array($export_type) && count($export_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $export_type when calling exportEntities' + ); + } + + // verify the required parameter 'api_key' is set + if ($api_key === null || (is_array($api_key) && count($api_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $api_key when calling exportEntities' + ); + } + + // verify the required parameter 'output_format' is set + if ($output_format === null || (is_array($output_format) && count($output_format) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $output_format when calling exportEntities' + ); + } + + + + + + + + $resourcePath = '/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $export_type, + 'exportType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $api_key, + 'apiKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $output_format, + 'outputFormat', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $list_separator_token, + 'listSeparatorToken', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $exclude_previously_exported, + 'excludePreviouslyExported', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_earliest_time, + 'createdEarliestTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_oldest_time, + 'createdOldestTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getExportLink + * + * Get export link + * + * @param string $export_type export_type (required) + * @param \MailSlurp\Models\ExportOptions $export_options export_options (required) + * @param string $api_key api_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ExportLink + */ + public function getExportLink($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0]) + { + list($response) = $this->getExportLinkWithHttpInfo($export_type, $export_options, $api_key, $contentType); + return $response; + } + + /** + * Operation getExportLinkWithHttpInfo + * + * Get export link + * + * @param string $export_type (required) + * @param \MailSlurp\Models\ExportOptions $export_options (required) + * @param string $api_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ExportLink, HTTP status code, HTTP response headers (array of strings) + */ + public function getExportLinkWithHttpInfo($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0]) + { + $request = $this->getExportLinkRequest($export_type, $export_options, $api_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ExportLink' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ExportLink' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExportLink', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ExportLink'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ExportLink', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExportLinkAsync + * + * Get export link + * + * @param string $export_type (required) + * @param \MailSlurp\Models\ExportOptions $export_options (required) + * @param string $api_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExportLinkAsync($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0]) + { + return $this->getExportLinkAsyncWithHttpInfo($export_type, $export_options, $api_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExportLinkAsyncWithHttpInfo + * + * Get export link + * + * @param string $export_type (required) + * @param \MailSlurp\Models\ExportOptions $export_options (required) + * @param string $api_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExportLinkAsyncWithHttpInfo($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0]) + { + $returnType = '\MailSlurp\Models\ExportLink'; + $request = $this->getExportLinkRequest($export_type, $export_options, $api_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getExportLink' + * + * @param string $export_type (required) + * @param \MailSlurp\Models\ExportOptions $export_options (required) + * @param string $api_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExportLinkRequest($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0]) + { + + // verify the required parameter 'export_type' is set + if ($export_type === null || (is_array($export_type) && count($export_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $export_type when calling getExportLink' + ); + } + + // verify the required parameter 'export_options' is set + if ($export_options === null || (is_array($export_options) && count($export_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $export_options when calling getExportLink' + ); + } + + + + $resourcePath = '/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $export_type, + 'exportType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $api_key, + 'apiKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($export_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($export_options)); + } else { + $httpBody = $export_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/FormControllerApi.php b/lib/Apis/FormControllerApi.php new file mode 100644 index 00000000..58088b83 --- /dev/null +++ b/lib/Apis/FormControllerApi.php @@ -0,0 +1,517 @@ + [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation submitForm + * + * Submit a form to be parsed and sent as an email to an address determined by the form fields + * + * @param string $_to The email address that submitted form should be sent to. (optional) + * @param string $_subject Optional subject of the email that will be sent. (optional) + * @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional) + * @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional) + * @param string $_success_message Optional success message to display if no _redirectTo present. (optional) + * @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional) + * @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function submitForm($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0]) + { + list($response) = $this->submitFormWithHttpInfo($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType); + return $response; + } + + /** + * Operation submitFormWithHttpInfo + * + * Submit a form to be parsed and sent as an email to an address determined by the form fields + * + * @param string $_to The email address that submitted form should be sent to. (optional) + * @param string $_subject Optional subject of the email that will be sent. (optional) + * @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional) + * @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional) + * @param string $_success_message Optional success message to display if no _redirectTo present. (optional) + * @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional) + * @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function submitFormWithHttpInfo($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0]) + { + $request = $this->submitFormRequest($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation submitFormAsync + * + * Submit a form to be parsed and sent as an email to an address determined by the form fields + * + * @param string $_to The email address that submitted form should be sent to. (optional) + * @param string $_subject Optional subject of the email that will be sent. (optional) + * @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional) + * @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional) + * @param string $_success_message Optional success message to display if no _redirectTo present. (optional) + * @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional) + * @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function submitFormAsync($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0]) + { + return $this->submitFormAsyncWithHttpInfo($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation submitFormAsyncWithHttpInfo + * + * Submit a form to be parsed and sent as an email to an address determined by the form fields + * + * @param string $_to The email address that submitted form should be sent to. (optional) + * @param string $_subject Optional subject of the email that will be sent. (optional) + * @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional) + * @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional) + * @param string $_success_message Optional success message to display if no _redirectTo present. (optional) + * @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional) + * @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function submitFormAsyncWithHttpInfo($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0]) + { + $returnType = 'string'; + $request = $this->submitFormRequest($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'submitForm' + * + * @param string $_to The email address that submitted form should be sent to. (optional) + * @param string $_subject Optional subject of the email that will be sent. (optional) + * @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional) + * @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional) + * @param string $_success_message Optional success message to display if no _redirectTo present. (optional) + * @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional) + * @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function submitFormRequest($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0]) + { + + + + + + + + + + $resourcePath = '/forms'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_to, + '_to', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_subject, + '_subject', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_redirect_to, + '_redirectTo', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_email_address, + '_emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_success_message, + '_successMessage', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $_spam_check, + '_spamCheck', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $other_parameters, + 'otherParameters', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/GroupControllerApi.php b/lib/Apis/GroupControllerApi.php new file mode 100644 index 00000000..96414e2a --- /dev/null +++ b/lib/Apis/GroupControllerApi.php @@ -0,0 +1,2845 @@ + [ + 'application/json', + ], + 'createGroup' => [ + 'application/json', + ], + 'deleteGroup' => [ + 'application/json', + ], + 'getAllGroups' => [ + 'application/json', + ], + 'getGroup' => [ + 'application/json', + ], + 'getGroupWithContacts' => [ + 'application/json', + ], + 'getGroupWithContactsPaginated' => [ + 'application/json', + ], + 'getGroups' => [ + 'application/json', + ], + 'removeContactsFromGroup' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation addContactsToGroup + * + * Add contacts to a group + * + * @param string $group_id group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupContactsDto + */ + public function addContactsToGroup($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0]) + { + list($response) = $this->addContactsToGroupWithHttpInfo($group_id, $update_group_contacts, $contentType); + return $response; + } + + /** + * Operation addContactsToGroupWithHttpInfo + * + * Add contacts to a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function addContactsToGroupWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0]) + { + $request = $this->addContactsToGroupRequest($group_id, $update_group_contacts, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupContactsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupContactsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupContactsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addContactsToGroupAsync + * + * Add contacts to a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactsToGroupAsync($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0]) + { + return $this->addContactsToGroupAsyncWithHttpInfo($group_id, $update_group_contacts, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addContactsToGroupAsyncWithHttpInfo + * + * Add contacts to a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactsToGroupAsyncWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0]) + { + $returnType = '\MailSlurp\Models\GroupContactsDto'; + $request = $this->addContactsToGroupRequest($group_id, $update_group_contacts, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addContactsToGroup' + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addContactsToGroupRequest($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling addContactsToGroup' + ); + } + + // verify the required parameter 'update_group_contacts' is set + if ($update_group_contacts === null || (is_array($update_group_contacts) && count($update_group_contacts) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_group_contacts when calling addContactsToGroup' + ); + } + + + $resourcePath = '/groups/{groupId}/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_group_contacts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_group_contacts)); + } else { + $httpBody = $update_group_contacts; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createGroup + * + * Create a group + * + * @param \MailSlurp\Models\CreateGroupOptions $create_group_options create_group_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupDto + */ + public function createGroup($create_group_options, string $contentType = self::contentTypes['createGroup'][0]) + { + list($response) = $this->createGroupWithHttpInfo($create_group_options, $contentType); + return $response; + } + + /** + * Operation createGroupWithHttpInfo + * + * Create a group + * + * @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createGroupWithHttpInfo($create_group_options, string $contentType = self::contentTypes['createGroup'][0]) + { + $request = $this->createGroupRequest($create_group_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\GroupDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createGroupAsync + * + * Create a group + * + * @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createGroupAsync($create_group_options, string $contentType = self::contentTypes['createGroup'][0]) + { + return $this->createGroupAsyncWithHttpInfo($create_group_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createGroupAsyncWithHttpInfo + * + * Create a group + * + * @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createGroupAsyncWithHttpInfo($create_group_options, string $contentType = self::contentTypes['createGroup'][0]) + { + $returnType = '\MailSlurp\Models\GroupDto'; + $request = $this->createGroupRequest($create_group_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createGroup' + * + * @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createGroupRequest($create_group_options, string $contentType = self::contentTypes['createGroup'][0]) + { + + // verify the required parameter 'create_group_options' is set + if ($create_group_options === null || (is_array($create_group_options) && count($create_group_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_group_options when calling createGroup' + ); + } + + + $resourcePath = '/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_group_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_group_options)); + } else { + $httpBody = $create_group_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteGroup + * + * Delete group + * + * @param string $group_id group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteGroup($group_id, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $this->deleteGroupWithHttpInfo($group_id, $contentType); + } + + /** + * Operation deleteGroupWithHttpInfo + * + * Delete group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteGroupWithHttpInfo($group_id, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $request = $this->deleteGroupRequest($group_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteGroupAsync + * + * Delete group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteGroupAsync($group_id, string $contentType = self::contentTypes['deleteGroup'][0]) + { + return $this->deleteGroupAsyncWithHttpInfo($group_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteGroupAsyncWithHttpInfo + * + * Delete group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteGroupAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $returnType = ''; + $request = $this->deleteGroupRequest($group_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteGroup' + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteGroupRequest($group_id, string $contentType = self::contentTypes['deleteGroup'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling deleteGroup' + ); + } + + + $resourcePath = '/groups/{groupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllGroups + * + * Get all Contact Groups in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageGroupProjection + */ + public function getAllGroups($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0]) + { + list($response) = $this->getAllGroupsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllGroupsWithHttpInfo + * + * Get all Contact Groups in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageGroupProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllGroupsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0]) + { + $request = $this->getAllGroupsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageGroupProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageGroupProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageGroupProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageGroupProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageGroupProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllGroupsAsync + * + * Get all Contact Groups in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllGroupsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0]) + { + return $this->getAllGroupsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllGroupsAsyncWithHttpInfo + * + * Get all Contact Groups in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllGroupsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0]) + { + $returnType = '\MailSlurp\Models\PageGroupProjection'; + $request = $this->getAllGroupsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllGroups' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllGroupsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0]) + { + + + + + + + + $resourcePath = '/groups/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroup + * + * Get group + * + * @param string $group_id group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupDto + */ + public function getGroup($group_id, string $contentType = self::contentTypes['getGroup'][0]) + { + list($response) = $this->getGroupWithHttpInfo($group_id, $contentType); + return $response; + } + + /** + * Operation getGroupWithHttpInfo + * + * Get group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getGroupWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroup'][0]) + { + $request = $this->getGroupRequest($group_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GroupDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getGroupAsync + * + * Get group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupAsync($group_id, string $contentType = self::contentTypes['getGroup'][0]) + { + return $this->getGroupAsyncWithHttpInfo($group_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupAsyncWithHttpInfo + * + * Get group + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroup'][0]) + { + $returnType = '\MailSlurp\Models\GroupDto'; + $request = $this->getGroupRequest($group_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroup' + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupRequest($group_id, string $contentType = self::contentTypes['getGroup'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling getGroup' + ); + } + + + $resourcePath = '/groups/{groupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroupWithContacts + * + * Get group and contacts belonging to it + * + * @param string $group_id group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupContactsDto + */ + public function getGroupWithContacts($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0]) + { + list($response) = $this->getGroupWithContactsWithHttpInfo($group_id, $contentType); + return $response; + } + + /** + * Operation getGroupWithContactsWithHttpInfo + * + * Get group and contacts belonging to it + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getGroupWithContactsWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0]) + { + $request = $this->getGroupWithContactsRequest($group_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupContactsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupContactsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupContactsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getGroupWithContactsAsync + * + * Get group and contacts belonging to it + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupWithContactsAsync($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0]) + { + return $this->getGroupWithContactsAsyncWithHttpInfo($group_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupWithContactsAsyncWithHttpInfo + * + * Get group and contacts belonging to it + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupWithContactsAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0]) + { + $returnType = '\MailSlurp\Models\GroupContactsDto'; + $request = $this->getGroupWithContactsRequest($group_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroupWithContacts' + * + * @param string $group_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupWithContactsRequest($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling getGroupWithContacts' + ); + } + + + $resourcePath = '/groups/{groupId}/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroupWithContactsPaginated + * + * @param string $group_id group_id (required) + * @param int $page Optional page index in group contact pagination (optional, default to 0) + * @param int $size Optional page size in group contact pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageContactProjection + */ + public function getGroupWithContactsPaginated($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0]) + { + list($response) = $this->getGroupWithContactsPaginatedWithHttpInfo($group_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getGroupWithContactsPaginatedWithHttpInfo + * + * @param string $group_id (required) + * @param int $page Optional page index in group contact pagination (optional, default to 0) + * @param int $size Optional page size in group contact pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageContactProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getGroupWithContactsPaginatedWithHttpInfo($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0]) + { + $request = $this->getGroupWithContactsPaginatedRequest($group_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageContactProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageContactProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageContactProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageContactProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageContactProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getGroupWithContactsPaginatedAsync + * + * @param string $group_id (required) + * @param int $page Optional page index in group contact pagination (optional, default to 0) + * @param int $size Optional page size in group contact pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupWithContactsPaginatedAsync($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0]) + { + return $this->getGroupWithContactsPaginatedAsyncWithHttpInfo($group_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupWithContactsPaginatedAsyncWithHttpInfo + * + * @param string $group_id (required) + * @param int $page Optional page index in group contact pagination (optional, default to 0) + * @param int $size Optional page size in group contact pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupWithContactsPaginatedAsyncWithHttpInfo($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageContactProjection'; + $request = $this->getGroupWithContactsPaginatedRequest($group_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroupWithContactsPaginated' + * + * @param string $group_id (required) + * @param int $page Optional page index in group contact pagination (optional, default to 0) + * @param int $size Optional page size in group contact pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupWithContactsPaginatedRequest($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling getGroupWithContactsPaginated' + ); + } + + + + + + + + $resourcePath = '/groups/{groupId}/contacts-paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroups + * + * Get all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupProjection[] + */ + public function getGroups(string $contentType = self::contentTypes['getGroups'][0]) + { + list($response) = $this->getGroupsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getGroupsWithHttpInfo + * + * Get all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupProjection[], HTTP status code, HTTP response headers (array of strings) + */ + public function getGroupsWithHttpInfo(string $contentType = self::contentTypes['getGroups'][0]) + { + $request = $this->getGroupsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GroupProjection[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupProjection[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupProjection[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupProjection[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupProjection[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getGroupsAsync + * + * Get all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupsAsync(string $contentType = self::contentTypes['getGroups'][0]) + { + return $this->getGroupsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupsAsyncWithHttpInfo + * + * Get all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['getGroups'][0]) + { + $returnType = '\MailSlurp\Models\GroupProjection[]'; + $request = $this->getGroupsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroups' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupsRequest(string $contentType = self::contentTypes['getGroups'][0]) + { + + + $resourcePath = '/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeContactsFromGroup + * + * Remove contacts from a group + * + * @param string $group_id group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\GroupContactsDto + */ + public function removeContactsFromGroup($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0]) + { + list($response) = $this->removeContactsFromGroupWithHttpInfo($group_id, $update_group_contacts, $contentType); + return $response; + } + + /** + * Operation removeContactsFromGroupWithHttpInfo + * + * Remove contacts from a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function removeContactsFromGroupWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0]) + { + $request = $this->removeContactsFromGroupRequest($group_id, $update_group_contacts, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\GroupContactsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\GroupContactsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\GroupContactsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation removeContactsFromGroupAsync + * + * Remove contacts from a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactsFromGroupAsync($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0]) + { + return $this->removeContactsFromGroupAsyncWithHttpInfo($group_id, $update_group_contacts, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeContactsFromGroupAsyncWithHttpInfo + * + * Remove contacts from a group + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactsFromGroupAsyncWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0]) + { + $returnType = '\MailSlurp\Models\GroupContactsDto'; + $request = $this->removeContactsFromGroupRequest($group_id, $update_group_contacts, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeContactsFromGroup' + * + * @param string $group_id (required) + * @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeContactsFromGroupRequest($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0]) + { + + // verify the required parameter 'group_id' is set + if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $group_id when calling removeContactsFromGroup' + ); + } + + // verify the required parameter 'update_group_contacts' is set + if ($update_group_contacts === null || (is_array($update_group_contacts) && count($update_group_contacts) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_group_contacts when calling removeContactsFromGroup' + ); + } + + + $resourcePath = '/groups/{groupId}/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group_id !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($group_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_group_contacts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_group_contacts)); + } else { + $httpBody = $update_group_contacts; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/InboxControllerApi.php b/lib/Apis/InboxControllerApi.php new file mode 100644 index 00000000..ae27fadb --- /dev/null +++ b/lib/Apis/InboxControllerApi.php @@ -0,0 +1,12411 @@ + [ + 'application/json', + ], + 'createInbox' => [ + 'application/json', + ], + 'createInboxRuleset' => [ + 'application/json', + ], + 'createInboxWithDefaults' => [ + 'application/json', + ], + 'createInboxWithOptions' => [ + 'application/json', + ], + 'deleteAllInboxEmails' => [ + 'application/json', + ], + 'deleteAllInboxes' => [ + 'application/json', + ], + 'deleteInbox' => [ + 'application/json', + ], + 'doesInboxExist' => [ + 'application/json', + ], + 'flushExpired' => [ + 'application/json', + ], + 'getAllInboxes' => [ + 'application/json', + ], + 'getAllScheduledJobs' => [ + 'application/json', + ], + 'getDeliveryStatusesByInboxId' => [ + 'application/json', + ], + 'getEmails' => [ + 'application/json', + ], + 'getImapSmtpAccess' => [ + 'application/json', + ], + 'getInbox' => [ + 'application/json', + ], + 'getInboxByEmailAddress' => [ + 'application/json', + ], + 'getInboxByName' => [ + 'application/json', + ], + 'getInboxCount' => [ + 'application/json', + ], + 'getInboxEmailCount' => [ + 'application/json', + ], + 'getInboxEmailsPaginated' => [ + 'application/json', + ], + 'getInboxIds' => [ + 'application/json', + ], + 'getInboxSentEmails' => [ + 'application/json', + ], + 'getInboxTags' => [ + 'application/json', + ], + 'getInboxes' => [ + 'application/json', + ], + 'getLatestEmailInInbox' => [ + 'application/json', + ], + 'getOrganizationInboxes' => [ + 'application/json', + ], + 'getScheduledJob' => [ + 'application/json', + ], + 'getScheduledJobsByInboxId' => [ + 'application/json', + ], + 'listInboxRulesets' => [ + 'application/json', + ], + 'listInboxTrackingPixels' => [ + 'application/json', + ], + 'sendEmail' => [ + 'application/json', + ], + 'sendEmailAndConfirm' => [ + 'application/json', + ], + 'sendEmailWithQueue' => [ + 'application/json', + ], + 'sendSmtpEnvelope' => [ + 'application/json', + ], + 'sendTestEmail' => [ + 'application/json', + ], + 'sendWithSchedule' => [ + 'application/json', + ], + 'setInboxFavourited' => [ + 'application/json', + ], + 'updateInbox' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation cancelScheduledJob + * + * Cancel a scheduled email job + * + * @param string $job_id job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ScheduledJobDto + */ + public function cancelScheduledJob($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0]) + { + list($response) = $this->cancelScheduledJobWithHttpInfo($job_id, $contentType); + return $response; + } + + /** + * Operation cancelScheduledJobWithHttpInfo + * + * Cancel a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelScheduledJobWithHttpInfo($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0]) + { + $request = $this->cancelScheduledJobRequest($job_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ScheduledJobDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelScheduledJobAsync + * + * Cancel a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelScheduledJobAsync($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0]) + { + return $this->cancelScheduledJobAsyncWithHttpInfo($job_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelScheduledJobAsyncWithHttpInfo + * + * Cancel a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelScheduledJobAsyncWithHttpInfo($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0]) + { + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + $request = $this->cancelScheduledJobRequest($job_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelScheduledJob' + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelScheduledJobRequest($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0]) + { + + // verify the required parameter 'job_id' is set + if ($job_id === null || (is_array($job_id) && count($job_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $job_id when calling cancelScheduledJob' + ); + } + + + $resourcePath = '/inboxes/scheduled-jobs/{jobId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($job_id !== null) { + $resourcePath = str_replace( + '{' . 'jobId' . '}', + ObjectSerializer::toPathValue($job_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createInbox + * + * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. + * + * @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional) + * @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional) + * @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional) + * @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional) + * @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional) + * @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional) + * @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional) + * @param int $expires_in Number of milliseconds that inbox should exist for (optional) + * @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional) + * @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. (optional) + * @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional) + * @param bool $use_short_address Use a shorter email address under 31 characters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function createInbox($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createInbox'][0]) + { + list($response) = $this->createInboxWithHttpInfo($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $contentType); + return $response; + } + + /** + * Operation createInboxWithHttpInfo + * + * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. + * + * @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional) + * @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional) + * @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional) + * @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional) + * @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional) + * @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional) + * @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional) + * @param int $expires_in Number of milliseconds that inbox should exist for (optional) + * @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional) + * @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. (optional) + * @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional) + * @param bool $use_short_address Use a shorter email address under 31 characters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createInboxWithHttpInfo($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createInbox'][0]) + { + $request = $this->createInboxRequest($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInboxAsync + * + * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. + * + * @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional) + * @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional) + * @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional) + * @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional) + * @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional) + * @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional) + * @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional) + * @param int $expires_in Number of milliseconds that inbox should exist for (optional) + * @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional) + * @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. (optional) + * @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional) + * @param bool $use_short_address Use a shorter email address under 31 characters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxAsync($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createInbox'][0]) + { + return $this->createInboxAsyncWithHttpInfo($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInboxAsyncWithHttpInfo + * + * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes. + * + * @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional) + * @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional) + * @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional) + * @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional) + * @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional) + * @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional) + * @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional) + * @param int $expires_in Number of milliseconds that inbox should exist for (optional) + * @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional) + * @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. (optional) + * @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional) + * @param bool $use_short_address Use a shorter email address under 31 characters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxAsyncWithHttpInfo($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->createInboxRequest($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createInbox' + * + * @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional) + * @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional) + * @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional) + * @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional) + * @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional) + * @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional) + * @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional) + * @param int $expires_in Number of milliseconds that inbox should exist for (optional) + * @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional) + * @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mx.mailslurp.com`. (optional) + * @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional) + * @param bool $use_short_address Use a shorter email address under 31 characters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInboxRequest($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, string $contentType = self::contentTypes['createInbox'][0]) + { + + + + + + + + + + + + + + + $resourcePath = '/inboxes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tags, + 'tags', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $description, + 'description', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_domain_pool, + 'useDomainPool', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $favourite, + 'favourite', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at, + 'expiresAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_in, + 'expiresIn', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $allow_team_access, + 'allowTeamAccess', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_type, + 'inboxType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $virtual_inbox, + 'virtualInbox', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $use_short_address, + 'useShortAddress', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createInboxRuleset + * + * Create an inbox ruleset + * + * @param string $inbox_id inboxId (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetDto + */ + public function createInboxRuleset($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0]) + { + list($response) = $this->createInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType); + return $response; + } + + /** + * Operation createInboxRulesetWithHttpInfo + * + * Create an inbox ruleset + * + * @param string $inbox_id inboxId (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0]) + { + $request = $this->createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInboxRulesetAsync + * + * Create an inbox ruleset + * + * @param string $inbox_id inboxId (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxRulesetAsync($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0]) + { + return $this->createInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInboxRulesetAsyncWithHttpInfo + * + * Create an inbox ruleset + * + * @param string $inbox_id inboxId (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + $request = $this->createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createInboxRuleset' + * + * @param string $inbox_id inboxId (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling createInboxRuleset' + ); + } + + // verify the required parameter 'create_inbox_ruleset_options' is set + if ($create_inbox_ruleset_options === null || (is_array($create_inbox_ruleset_options) && count($create_inbox_ruleset_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_inbox_ruleset_options when calling createInboxRuleset' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_inbox_ruleset_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_ruleset_options)); + } else { + $httpBody = $create_inbox_ruleset_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createInboxWithDefaults + * + * Create an inbox with default options. Uses MailSlurp domain pool address and is private. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function createInboxWithDefaults(string $contentType = self::contentTypes['createInboxWithDefaults'][0]) + { + list($response) = $this->createInboxWithDefaultsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation createInboxWithDefaultsWithHttpInfo + * + * Create an inbox with default options. Uses MailSlurp domain pool address and is private. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createInboxWithDefaultsWithHttpInfo(string $contentType = self::contentTypes['createInboxWithDefaults'][0]) + { + $request = $this->createInboxWithDefaultsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInboxWithDefaultsAsync + * + * Create an inbox with default options. Uses MailSlurp domain pool address and is private. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxWithDefaultsAsync(string $contentType = self::contentTypes['createInboxWithDefaults'][0]) + { + return $this->createInboxWithDefaultsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInboxWithDefaultsAsyncWithHttpInfo + * + * Create an inbox with default options. Uses MailSlurp domain pool address and is private. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxWithDefaultsAsyncWithHttpInfo(string $contentType = self::contentTypes['createInboxWithDefaults'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->createInboxWithDefaultsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createInboxWithDefaults' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInboxWithDefaultsRequest(string $contentType = self::contentTypes['createInboxWithDefaults'][0]) + { + + + $resourcePath = '/inboxes/withDefaults'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createInboxWithOptions + * + * Create an inbox with options. Extended options for inbox creation. + * + * @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto create_inbox_dto (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function createInboxWithOptions($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0]) + { + list($response) = $this->createInboxWithOptionsWithHttpInfo($create_inbox_dto, $contentType); + return $response; + } + + /** + * Operation createInboxWithOptionsWithHttpInfo + * + * Create an inbox with options. Extended options for inbox creation. + * + * @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createInboxWithOptionsWithHttpInfo($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0]) + { + $request = $this->createInboxWithOptionsRequest($create_inbox_dto, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInboxWithOptionsAsync + * + * Create an inbox with options. Extended options for inbox creation. + * + * @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxWithOptionsAsync($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0]) + { + return $this->createInboxWithOptionsAsyncWithHttpInfo($create_inbox_dto, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInboxWithOptionsAsyncWithHttpInfo + * + * Create an inbox with options. Extended options for inbox creation. + * + * @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInboxWithOptionsAsyncWithHttpInfo($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->createInboxWithOptionsRequest($create_inbox_dto, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createInboxWithOptions' + * + * @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInboxWithOptionsRequest($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0]) + { + + // verify the required parameter 'create_inbox_dto' is set + if ($create_inbox_dto === null || (is_array($create_inbox_dto) && count($create_inbox_dto) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_inbox_dto when calling createInboxWithOptions' + ); + } + + + $resourcePath = '/inboxes/withOptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_inbox_dto)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_dto)); + } else { + $httpBody = $create_inbox_dto; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAllInboxEmails + * + * Delete all emails in a given inboxes. + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllInboxEmails($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0]) + { + $this->deleteAllInboxEmailsWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation deleteAllInboxEmailsWithHttpInfo + * + * Delete all emails in a given inboxes. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllInboxEmailsWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0]) + { + $request = $this->deleteAllInboxEmailsRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllInboxEmailsAsync + * + * Delete all emails in a given inboxes. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllInboxEmailsAsync($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0]) + { + return $this->deleteAllInboxEmailsAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllInboxEmailsAsyncWithHttpInfo + * + * Delete all emails in a given inboxes. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllInboxEmailsAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0]) + { + $returnType = ''; + $request = $this->deleteAllInboxEmailsRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllInboxEmails' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllInboxEmailsRequest($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling deleteAllInboxEmails' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/deleteAllInboxEmails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAllInboxes + * + * Delete all inboxes + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllInboxes(string $contentType = self::contentTypes['deleteAllInboxes'][0]) + { + $this->deleteAllInboxesWithHttpInfo($contentType); + } + + /** + * Operation deleteAllInboxesWithHttpInfo + * + * Delete all inboxes + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllInboxesWithHttpInfo(string $contentType = self::contentTypes['deleteAllInboxes'][0]) + { + $request = $this->deleteAllInboxesRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllInboxesAsync + * + * Delete all inboxes + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllInboxesAsync(string $contentType = self::contentTypes['deleteAllInboxes'][0]) + { + return $this->deleteAllInboxesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllInboxesAsyncWithHttpInfo + * + * Delete all inboxes + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllInboxesAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllInboxes'][0]) + { + $returnType = ''; + $request = $this->deleteAllInboxesRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllInboxes' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllInboxesRequest(string $contentType = self::contentTypes['deleteAllInboxes'][0]) + { + + + $resourcePath = '/inboxes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteInbox + * + * Delete inbox + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteInbox($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0]) + { + $this->deleteInboxWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation deleteInboxWithHttpInfo + * + * Delete inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0]) + { + $request = $this->deleteInboxRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteInboxAsync + * + * Delete inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxAsync($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0]) + { + return $this->deleteInboxAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInboxAsyncWithHttpInfo + * + * Delete inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0]) + { + $returnType = ''; + $request = $this->deleteInboxRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteInbox' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteInboxRequest($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling deleteInbox' + ); + } + + + $resourcePath = '/inboxes/{inboxId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation doesInboxExist + * + * Does inbox exist + * + * @param string $email_address Email address (required) + * @param bool $allow_catch_all allow_catch_all (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxExistsDto + */ + public function doesInboxExist($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0]) + { + list($response) = $this->doesInboxExistWithHttpInfo($email_address, $allow_catch_all, $contentType); + return $response; + } + + /** + * Operation doesInboxExistWithHttpInfo + * + * Does inbox exist + * + * @param string $email_address Email address (required) + * @param bool $allow_catch_all (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxExistsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function doesInboxExistWithHttpInfo($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0]) + { + $request = $this->doesInboxExistRequest($email_address, $allow_catch_all, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxExistsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxExistsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxExistsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxExistsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxExistsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation doesInboxExistAsync + * + * Does inbox exist + * + * @param string $email_address Email address (required) + * @param bool $allow_catch_all (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doesInboxExistAsync($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0]) + { + return $this->doesInboxExistAsyncWithHttpInfo($email_address, $allow_catch_all, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation doesInboxExistAsyncWithHttpInfo + * + * Does inbox exist + * + * @param string $email_address Email address (required) + * @param bool $allow_catch_all (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doesInboxExistAsyncWithHttpInfo($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0]) + { + $returnType = '\MailSlurp\Models\InboxExistsDto'; + $request = $this->doesInboxExistRequest($email_address, $allow_catch_all, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'doesInboxExist' + * + * @param string $email_address Email address (required) + * @param bool $allow_catch_all (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function doesInboxExistRequest($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0]) + { + + // verify the required parameter 'email_address' is set + if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_address when calling doesInboxExist' + ); + } + + + + $resourcePath = '/inboxes/exists'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $allow_catch_all, + 'allowCatchAll', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation flushExpired + * + * Remove expired inboxes + * + * @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\FlushExpiredInboxesResult + */ + public function flushExpired($before = null, string $contentType = self::contentTypes['flushExpired'][0]) + { + list($response) = $this->flushExpiredWithHttpInfo($before, $contentType); + return $response; + } + + /** + * Operation flushExpiredWithHttpInfo + * + * Remove expired inboxes + * + * @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\FlushExpiredInboxesResult, HTTP status code, HTTP response headers (array of strings) + */ + public function flushExpiredWithHttpInfo($before = null, string $contentType = self::contentTypes['flushExpired'][0]) + { + $request = $this->flushExpiredRequest($before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\FlushExpiredInboxesResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\FlushExpiredInboxesResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\FlushExpiredInboxesResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\FlushExpiredInboxesResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\FlushExpiredInboxesResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation flushExpiredAsync + * + * Remove expired inboxes + * + * @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function flushExpiredAsync($before = null, string $contentType = self::contentTypes['flushExpired'][0]) + { + return $this->flushExpiredAsyncWithHttpInfo($before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation flushExpiredAsyncWithHttpInfo + * + * Remove expired inboxes + * + * @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function flushExpiredAsyncWithHttpInfo($before = null, string $contentType = self::contentTypes['flushExpired'][0]) + { + $returnType = '\MailSlurp\Models\FlushExpiredInboxesResult'; + $request = $this->flushExpiredRequest($before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'flushExpired' + * + * @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function flushExpiredRequest($before = null, string $contentType = self::contentTypes['flushExpired'][0]) + { + + + + $resourcePath = '/inboxes/expired'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllInboxes + * + * List All Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $favourite Optionally filter results for favourites only (optional, default to false) + * @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional) + * @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional) + * @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $inbox_type Optional filter by inbox type (optional) + * @param string $domain_id Optional domain ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageInboxProjection + */ + public function getAllInboxes($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0]) + { + list($response) = $this->getAllInboxesWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id, $contentType); + return $response; + } + + /** + * Operation getAllInboxesWithHttpInfo + * + * List All Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $favourite Optionally filter results for favourites only (optional, default to false) + * @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional) + * @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional) + * @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $inbox_type Optional filter by inbox type (optional) + * @param string $domain_id Optional domain ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageInboxProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0]) + { + $request = $this->getAllInboxesRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageInboxProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageInboxProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageInboxProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageInboxProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllInboxesAsync + * + * List All Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $favourite Optionally filter results for favourites only (optional, default to false) + * @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional) + * @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional) + * @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $inbox_type Optional filter by inbox type (optional) + * @param string $domain_id Optional domain ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0]) + { + return $this->getAllInboxesAsyncWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllInboxesAsyncWithHttpInfo + * + * List All Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $favourite Optionally filter results for favourites only (optional, default to false) + * @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional) + * @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional) + * @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $inbox_type Optional filter by inbox type (optional) + * @param string $domain_id Optional domain ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0]) + { + $returnType = '\MailSlurp\Models\PageInboxProjection'; + $request = $this->getAllInboxesRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $domain_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllInboxes' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $favourite Optionally filter results for favourites only (optional, default to false) + * @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional) + * @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional) + * @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $inbox_type Optional filter by inbox type (optional) + * @param string $domain_id Optional domain ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0]) + { + + + + + + + + + + + + + + $resourcePath = '/inboxes/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $favourite, + 'favourite', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tag, + 'tag', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $team_access, + 'teamAccess', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_type, + 'inboxType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $domain_id, + 'domainId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllScheduledJobs + * + * Get all scheduled email sending jobs for account + * + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageScheduledJobs + */ + public function getAllScheduledJobs($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0]) + { + list($response) = $this->getAllScheduledJobsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllScheduledJobsWithHttpInfo + * + * Get all scheduled email sending jobs for account + * + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageScheduledJobs, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllScheduledJobsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0]) + { + $request = $this->getAllScheduledJobsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageScheduledJobs' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageScheduledJobs' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageScheduledJobs', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageScheduledJobs'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageScheduledJobs', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllScheduledJobsAsync + * + * Get all scheduled email sending jobs for account + * + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllScheduledJobsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0]) + { + return $this->getAllScheduledJobsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllScheduledJobsAsyncWithHttpInfo + * + * Get all scheduled email sending jobs for account + * + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllScheduledJobsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0]) + { + $returnType = '\MailSlurp\Models\PageScheduledJobs'; + $request = $this->getAllScheduledJobsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllScheduledJobs' + * + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllScheduledJobsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0]) + { + + + + + + + + $resourcePath = '/inboxes/scheduled-jobs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDeliveryStatusesByInboxId + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageDeliveryStatus + */ + public function getDeliveryStatusesByInboxId($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0]) + { + list($response) = $this->getDeliveryStatusesByInboxIdWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getDeliveryStatusesByInboxIdWithHttpInfo + * + * @param string $inbox_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings) + */ + public function getDeliveryStatusesByInboxIdWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0]) + { + $request = $this->getDeliveryStatusesByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageDeliveryStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDeliveryStatusesByInboxIdAsync + * + * @param string $inbox_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryStatusesByInboxIdAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0]) + { + return $this->getDeliveryStatusesByInboxIdAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDeliveryStatusesByInboxIdAsyncWithHttpInfo + * + * @param string $inbox_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryStatusesByInboxIdAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0]) + { + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + $request = $this->getDeliveryStatusesByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDeliveryStatusesByInboxId' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDeliveryStatusesByInboxIdRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getDeliveryStatusesByInboxId' + ); + } + + + + + + + + $resourcePath = '/inboxes/{inboxId}/delivery-status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmails + * + * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional) + * @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional) + * @param string $sort Sort the results by received date and direction ASC or DESC (optional) + * @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional) + * @param int $delay_timeout delay_timeout (optional) + * @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional) + * @param bool $unread_only unread_only (optional) + * @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional) + * @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview[] + */ + public function getEmails($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0]) + { + list($response) = $this->getEmailsWithHttpInfo($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType); + return $response; + } + + /** + * Operation getEmailsWithHttpInfo + * + * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional) + * @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional) + * @param string $sort Sort the results by received date and direction ASC or DESC (optional) + * @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional) + * @param int $delay_timeout (optional) + * @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional) + * @param bool $unread_only (optional) + * @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional) + * @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailsWithHttpInfo($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0]) + { + $request = $this->getEmailsRequest($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmailsAsync + * + * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional) + * @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional) + * @param string $sort Sort the results by received date and direction ASC or DESC (optional) + * @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional) + * @param int $delay_timeout (optional) + * @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional) + * @param bool $unread_only (optional) + * @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional) + * @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsAsync($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0]) + { + return $this->getEmailsAsyncWithHttpInfo($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailsAsyncWithHttpInfo + * + * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead. + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional) + * @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional) + * @param string $sort Sort the results by received date and direction ASC or DESC (optional) + * @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional) + * @param int $delay_timeout (optional) + * @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional) + * @param bool $unread_only (optional) + * @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional) + * @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailsAsyncWithHttpInfo($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview[]'; + $request = $this->getEmailsRequest($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmails' + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional) + * @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional) + * @param string $sort Sort the results by received date and direction ASC or DESC (optional) + * @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional) + * @param int $delay_timeout (optional) + * @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional) + * @param bool $unread_only (optional) + * @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional) + * @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmailsRequest($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getEmails' + ); + } + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling InboxControllerApi.getEmails, must be smaller than or equal to 100.'); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling InboxControllerApi.getEmails, must be smaller than or equal to 100.'); + } + + + + + + + + + + $resourcePath = '/inboxes/{inboxId}/emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $retry_timeout, + 'retryTimeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay_timeout, + 'delayTimeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $min_count, + 'minCount', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getImapSmtpAccess + * + * @param string $inbox_id Inbox ID (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ImapSmtpAccessDetails + */ + public function getImapSmtpAccess($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0]) + { + list($response) = $this->getImapSmtpAccessWithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getImapSmtpAccessWithHttpInfo + * + * @param string $inbox_id Inbox ID (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ImapSmtpAccessDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function getImapSmtpAccessWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0]) + { + $request = $this->getImapSmtpAccessRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ImapSmtpAccessDetails' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ImapSmtpAccessDetails' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapSmtpAccessDetails', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ImapSmtpAccessDetails'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ImapSmtpAccessDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getImapSmtpAccessAsync + * + * @param string $inbox_id Inbox ID (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getImapSmtpAccessAsync($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0]) + { + return $this->getImapSmtpAccessAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getImapSmtpAccessAsyncWithHttpInfo + * + * @param string $inbox_id Inbox ID (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getImapSmtpAccessAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0]) + { + $returnType = '\MailSlurp\Models\ImapSmtpAccessDetails'; + $request = $this->getImapSmtpAccessRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getImapSmtpAccess' + * + * @param string $inbox_id Inbox ID (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getImapSmtpAccessRequest($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0]) + { + + + + $resourcePath = '/inboxes/imap-smtp-access'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInbox + * + * Get Inbox. Returns properties of an inbox. + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function getInbox($inbox_id, string $contentType = self::contentTypes['getInbox'][0]) + { + list($response) = $this->getInboxWithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getInboxWithHttpInfo + * + * Get Inbox. Returns properties of an inbox. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInbox'][0]) + { + $request = $this->getInboxRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxAsync + * + * Get Inbox. Returns properties of an inbox. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxAsync($inbox_id, string $contentType = self::contentTypes['getInbox'][0]) + { + return $this->getInboxAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxAsyncWithHttpInfo + * + * Get Inbox. Returns properties of an inbox. + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->getInboxRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInbox' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxRequest($inbox_id, string $contentType = self::contentTypes['getInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getInbox' + ); + } + + + $resourcePath = '/inboxes/{inboxId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxByEmailAddress + * + * Search for an inbox with the provided email address + * + * @param string $email_address email_address (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxByEmailAddressResult + */ + public function getInboxByEmailAddress($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0]) + { + list($response) = $this->getInboxByEmailAddressWithHttpInfo($email_address, $contentType); + return $response; + } + + /** + * Operation getInboxByEmailAddressWithHttpInfo + * + * Search for an inbox with the provided email address + * + * @param string $email_address (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxByEmailAddressResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxByEmailAddressWithHttpInfo($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0]) + { + $request = $this->getInboxByEmailAddressRequest($email_address, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxByEmailAddressResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxByEmailAddressResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxByEmailAddressResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxByEmailAddressResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxByEmailAddressResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxByEmailAddressAsync + * + * Search for an inbox with the provided email address + * + * @param string $email_address (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxByEmailAddressAsync($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0]) + { + return $this->getInboxByEmailAddressAsyncWithHttpInfo($email_address, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxByEmailAddressAsyncWithHttpInfo + * + * Search for an inbox with the provided email address + * + * @param string $email_address (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxByEmailAddressAsyncWithHttpInfo($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0]) + { + $returnType = '\MailSlurp\Models\InboxByEmailAddressResult'; + $request = $this->getInboxByEmailAddressRequest($email_address, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxByEmailAddress' + * + * @param string $email_address (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxByEmailAddressRequest($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0]) + { + + // verify the required parameter 'email_address' is set + if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_address when calling getInboxByEmailAddress' + ); + } + + + $resourcePath = '/inboxes/byEmailAddress'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'emailAddress', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxByName + * + * Search for an inbox with the given name + * + * @param string $name name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxByNameResult + */ + public function getInboxByName($name, string $contentType = self::contentTypes['getInboxByName'][0]) + { + list($response) = $this->getInboxByNameWithHttpInfo($name, $contentType); + return $response; + } + + /** + * Operation getInboxByNameWithHttpInfo + * + * Search for an inbox with the given name + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxByNameResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxByNameWithHttpInfo($name, string $contentType = self::contentTypes['getInboxByName'][0]) + { + $request = $this->getInboxByNameRequest($name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxByNameResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxByNameResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxByNameResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxByNameResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxByNameResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxByNameAsync + * + * Search for an inbox with the given name + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxByNameAsync($name, string $contentType = self::contentTypes['getInboxByName'][0]) + { + return $this->getInboxByNameAsyncWithHttpInfo($name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxByNameAsyncWithHttpInfo + * + * Search for an inbox with the given name + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxByNameAsyncWithHttpInfo($name, string $contentType = self::contentTypes['getInboxByName'][0]) + { + $returnType = '\MailSlurp\Models\InboxByNameResult'; + $request = $this->getInboxByNameRequest($name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxByName' + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxByNameRequest($name, string $contentType = self::contentTypes['getInboxByName'][0]) + { + + // verify the required parameter 'name' is set + if ($name === null || (is_array($name) && count($name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $name when calling getInboxByName' + ); + } + + + $resourcePath = '/inboxes/byName'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxCount + * + * Get total inbox count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\CountDto + */ + public function getInboxCount(string $contentType = self::contentTypes['getInboxCount'][0]) + { + list($response) = $this->getInboxCountWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getInboxCountWithHttpInfo + * + * Get total inbox count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxCountWithHttpInfo(string $contentType = self::contentTypes['getInboxCount'][0]) + { + $request = $this->getInboxCountRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\CountDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\CountDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\CountDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\CountDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxCountAsync + * + * Get total inbox count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxCountAsync(string $contentType = self::contentTypes['getInboxCount'][0]) + { + return $this->getInboxCountAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxCountAsyncWithHttpInfo + * + * Get total inbox count + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxCount'][0]) + { + $returnType = '\MailSlurp\Models\CountDto'; + $request = $this->getInboxCountRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxCount' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxCountRequest(string $contentType = self::contentTypes['getInboxCount'][0]) + { + + + $resourcePath = '/inboxes/count'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxEmailCount + * + * Get email count in inbox + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\CountDto + */ + public function getInboxEmailCount($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0]) + { + list($response) = $this->getInboxEmailCountWithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getInboxEmailCountWithHttpInfo + * + * Get email count in inbox + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxEmailCountWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0]) + { + $request = $this->getInboxEmailCountRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\CountDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\CountDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\CountDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\CountDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxEmailCountAsync + * + * Get email count in inbox + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxEmailCountAsync($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0]) + { + return $this->getInboxEmailCountAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxEmailCountAsyncWithHttpInfo + * + * Get email count in inbox + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxEmailCountAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0]) + { + $returnType = '\MailSlurp\Models\CountDto'; + $request = $this->getInboxEmailCountRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxEmailCount' + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxEmailCountRequest($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getInboxEmailCount' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/emails/count'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxEmailsPaginated + * + * Get inbox emails paginated + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $page Optional page index in inbox emails list pagination (optional, default to 0) + * @param int $size Optional page size in inbox emails list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by received after given date time (optional) + * @param \DateTime $before Optional filter by received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageEmailPreview + */ + public function getInboxEmailsPaginated($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0]) + { + list($response) = $this->getInboxEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxEmailsPaginatedWithHttpInfo + * + * Get inbox emails paginated + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $page Optional page index in inbox emails list pagination (optional, default to 0) + * @param int $size Optional page size in inbox emails list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by received after given date time (optional) + * @param \DateTime $before Optional filter by received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageEmailPreview, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxEmailsPaginatedWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0]) + { + $request = $this->getInboxEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageEmailPreview' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageEmailPreview' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailPreview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageEmailPreview'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageEmailPreview', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxEmailsPaginatedAsync + * + * Get inbox emails paginated + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $page Optional page index in inbox emails list pagination (optional, default to 0) + * @param int $size Optional page size in inbox emails list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by received after given date time (optional) + * @param \DateTime $before Optional filter by received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxEmailsPaginatedAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0]) + { + return $this->getInboxEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxEmailsPaginatedAsyncWithHttpInfo + * + * Get inbox emails paginated + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $page Optional page index in inbox emails list pagination (optional, default to 0) + * @param int $size Optional page size in inbox emails list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by received after given date time (optional) + * @param \DateTime $before Optional filter by received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageEmailPreview'; + $request = $this->getInboxEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxEmailsPaginated' + * + * @param string $inbox_id Id of inbox that emails belongs to (required) + * @param int $page Optional page index in inbox emails list pagination (optional, default to 0) + * @param int $size Optional page size in inbox emails list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by received after given date time (optional) + * @param \DateTime $before Optional filter by received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxEmailsPaginatedRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getInboxEmailsPaginated' + ); + } + + + + + + + + $resourcePath = '/inboxes/{inboxId}/emails/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxIds + * + * Get all inbox IDs + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxIdsResult + */ + public function getInboxIds(string $contentType = self::contentTypes['getInboxIds'][0]) + { + list($response) = $this->getInboxIdsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getInboxIdsWithHttpInfo + * + * Get all inbox IDs + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxIdsResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxIdsWithHttpInfo(string $contentType = self::contentTypes['getInboxIds'][0]) + { + $request = $this->getInboxIdsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxIdsResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxIdsResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxIdsResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxIdsResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxIdsResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxIdsAsync + * + * Get all inbox IDs + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxIdsAsync(string $contentType = self::contentTypes['getInboxIds'][0]) + { + return $this->getInboxIdsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxIdsAsyncWithHttpInfo + * + * Get all inbox IDs + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxIdsAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxIds'][0]) + { + $returnType = '\MailSlurp\Models\InboxIdsResult'; + $request = $this->getInboxIdsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxIds' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxIdsRequest(string $contentType = self::contentTypes['getInboxIds'][0]) + { + + + $resourcePath = '/inboxes/ids'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxSentEmails + * + * Get Inbox Sent Emails + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional sent email search (optional) + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageSentEmailProjection + */ + public function getInboxSentEmails($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0]) + { + list($response) = $this->getInboxSentEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxSentEmailsWithHttpInfo + * + * Get Inbox Sent Emails + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional sent email search (optional) + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxSentEmailsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0]) + { + $request = $this->getInboxSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageSentEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxSentEmailsAsync + * + * Get Inbox Sent Emails + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional sent email search (optional) + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxSentEmailsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0]) + { + return $this->getInboxSentEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxSentEmailsAsyncWithHttpInfo + * + * Get Inbox Sent Emails + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional sent email search (optional) + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxSentEmailsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + $request = $this->getInboxSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxSentEmails' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional sent email search (optional) + * @param \DateTime $since Optional filter by sent after given date time (optional) + * @param \DateTime $before Optional filter by sent before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxSentEmailsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getInboxSentEmails' + ); + } + + + + + + + + + $resourcePath = '/inboxes/{inboxId}/sent'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxTags + * + * Get inbox tags + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function getInboxTags(string $contentType = self::contentTypes['getInboxTags'][0]) + { + list($response) = $this->getInboxTagsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getInboxTagsWithHttpInfo + * + * Get inbox tags + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxTagsWithHttpInfo(string $contentType = self::contentTypes['getInboxTags'][0]) + { + $request = $this->getInboxTagsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxTagsAsync + * + * Get inbox tags + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxTagsAsync(string $contentType = self::contentTypes['getInboxTags'][0]) + { + return $this->getInboxTagsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxTagsAsyncWithHttpInfo + * + * Get inbox tags + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxTagsAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxTags'][0]) + { + $returnType = 'string[]'; + $request = $this->getInboxTagsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxTags' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxTagsRequest(string $contentType = self::contentTypes['getInboxTags'][0]) + { + + + $resourcePath = '/inboxes/tags'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxes + * + * List Inboxes and email addresses + * + * @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto[] + * @deprecated + */ + public function getInboxes($size = 100, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0]) + { + list($response) = $this->getInboxesWithHttpInfo($size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxesWithHttpInfo + * + * List Inboxes and email addresses + * + * @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto[], HTTP status code, HTTP response headers (array of strings) + * @deprecated + */ + public function getInboxesWithHttpInfo($size = 100, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0]) + { + $request = $this->getInboxesRequest($size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxDto[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxesAsync + * + * List Inboxes and email addresses + * + * @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function getInboxesAsync($size = 100, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0]) + { + return $this->getInboxesAsyncWithHttpInfo($size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxesAsyncWithHttpInfo + * + * List Inboxes and email addresses + * + * @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function getInboxesAsyncWithHttpInfo($size = 100, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto[]'; + $request = $this->getInboxesRequest($size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxes' + * + * @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function getInboxesRequest($size = 100, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0]) + { + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling InboxControllerApi.getInboxes, must be smaller than or equal to 100.'); + } + + + + + + $resourcePath = '/inboxes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLatestEmailInInbox + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param int $timeout_millis Timeout milliseconds to wait for latest email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function getLatestEmailInInbox($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0]) + { + list($response) = $this->getLatestEmailInInboxWithHttpInfo($inbox_id, $timeout_millis, $contentType); + return $response; + } + + /** + * Operation getLatestEmailInInboxWithHttpInfo + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param int $timeout_millis Timeout milliseconds to wait for latest email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function getLatestEmailInInboxWithHttpInfo($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0]) + { + $request = $this->getLatestEmailInInboxRequest($inbox_id, $timeout_millis, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLatestEmailInInboxAsync + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param int $timeout_millis Timeout milliseconds to wait for latest email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailInInboxAsync($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0]) + { + return $this->getLatestEmailInInboxAsyncWithHttpInfo($inbox_id, $timeout_millis, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLatestEmailInInboxAsyncWithHttpInfo + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param int $timeout_millis Timeout milliseconds to wait for latest email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLatestEmailInInboxAsyncWithHttpInfo($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->getLatestEmailInInboxRequest($inbox_id, $timeout_millis, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLatestEmailInInbox' + * + * @param string $inbox_id ID of the inbox you want to get the latest email from (required) + * @param int $timeout_millis Timeout milliseconds to wait for latest email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLatestEmailInInboxRequest($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getLatestEmailInInbox' + ); + } + + // verify the required parameter 'timeout_millis' is set + if ($timeout_millis === null || (is_array($timeout_millis) && count($timeout_millis) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $timeout_millis when calling getLatestEmailInInbox' + ); + } + + + $resourcePath = '/inboxes/getLatestEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout_millis, + 'timeoutMillis', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOrganizationInboxes + * + * List Organization Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageOrganizationInboxProjection + */ + public function getOrganizationInboxes($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0]) + { + list($response) = $this->getOrganizationInboxesWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getOrganizationInboxesWithHttpInfo + * + * List Organization Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageOrganizationInboxProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0]) + { + $request = $this->getOrganizationInboxesRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageOrganizationInboxProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageOrganizationInboxProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageOrganizationInboxProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageOrganizationInboxProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageOrganizationInboxProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationInboxesAsync + * + * List Organization Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0]) + { + return $this->getOrganizationInboxesAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationInboxesAsyncWithHttpInfo + * + * List Organization Inboxes Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0]) + { + $returnType = '\MailSlurp\Models\PageOrganizationInboxProjection'; + $request = $this->getOrganizationInboxesRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOrganizationInboxes' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOrganizationInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0]) + { + + + + + + + + + $resourcePath = '/inboxes/organization'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScheduledJob + * + * Get a scheduled email job + * + * @param string $job_id job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ScheduledJobDto + */ + public function getScheduledJob($job_id, string $contentType = self::contentTypes['getScheduledJob'][0]) + { + list($response) = $this->getScheduledJobWithHttpInfo($job_id, $contentType); + return $response; + } + + /** + * Operation getScheduledJobWithHttpInfo + * + * Get a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getScheduledJobWithHttpInfo($job_id, string $contentType = self::contentTypes['getScheduledJob'][0]) + { + $request = $this->getScheduledJobRequest($job_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ScheduledJobDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getScheduledJobAsync + * + * Get a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduledJobAsync($job_id, string $contentType = self::contentTypes['getScheduledJob'][0]) + { + return $this->getScheduledJobAsyncWithHttpInfo($job_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScheduledJobAsyncWithHttpInfo + * + * Get a scheduled email job + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduledJobAsyncWithHttpInfo($job_id, string $contentType = self::contentTypes['getScheduledJob'][0]) + { + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + $request = $this->getScheduledJobRequest($job_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScheduledJob' + * + * @param string $job_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScheduledJobRequest($job_id, string $contentType = self::contentTypes['getScheduledJob'][0]) + { + + // verify the required parameter 'job_id' is set + if ($job_id === null || (is_array($job_id) && count($job_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $job_id when calling getScheduledJob' + ); + } + + + $resourcePath = '/inboxes/scheduled-jobs/{jobId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($job_id !== null) { + $resourcePath = str_replace( + '{' . 'jobId' . '}', + ObjectSerializer::toPathValue($job_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScheduledJobsByInboxId + * + * Get all scheduled email sending jobs for the inbox + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageScheduledJobs + */ + public function getScheduledJobsByInboxId($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0]) + { + list($response) = $this->getScheduledJobsByInboxIdWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getScheduledJobsByInboxIdWithHttpInfo + * + * Get all scheduled email sending jobs for the inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageScheduledJobs, HTTP status code, HTTP response headers (array of strings) + */ + public function getScheduledJobsByInboxIdWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0]) + { + $request = $this->getScheduledJobsByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageScheduledJobs' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageScheduledJobs' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageScheduledJobs', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageScheduledJobs'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageScheduledJobs', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getScheduledJobsByInboxIdAsync + * + * Get all scheduled email sending jobs for the inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduledJobsByInboxIdAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0]) + { + return $this->getScheduledJobsByInboxIdAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScheduledJobsByInboxIdAsyncWithHttpInfo + * + * Get all scheduled email sending jobs for the inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduledJobsByInboxIdAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0]) + { + $returnType = '\MailSlurp\Models\PageScheduledJobs'; + $request = $this->getScheduledJobsByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScheduledJobsByInboxId' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in scheduled job list pagination (optional, default to 0) + * @param int $size Optional page size in scheduled job list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScheduledJobsByInboxIdRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getScheduledJobsByInboxId' + ); + } + + + + + + + + $resourcePath = '/inboxes/{inboxId}/scheduled-jobs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listInboxRulesets + * + * List inbox rulesets + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageInboxRulesetDto + */ + public function listInboxRulesets($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0]) + { + list($response) = $this->listInboxRulesetsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation listInboxRulesetsWithHttpInfo + * + * List inbox rulesets + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageInboxRulesetDto, HTTP status code, HTTP response headers (array of strings) + */ + public function listInboxRulesetsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0]) + { + $request = $this->listInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageInboxRulesetDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageInboxRulesetDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxRulesetDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageInboxRulesetDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageInboxRulesetDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listInboxRulesetsAsync + * + * List inbox rulesets + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listInboxRulesetsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0]) + { + return $this->listInboxRulesetsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listInboxRulesetsAsyncWithHttpInfo + * + * List inbox rulesets + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listInboxRulesetsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0]) + { + $returnType = '\MailSlurp\Models\PageInboxRulesetDto'; + $request = $this->listInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listInboxRulesets' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listInboxRulesetsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling listInboxRulesets' + ); + } + + + + + + + + + $resourcePath = '/inboxes/{inboxId}/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listInboxTrackingPixels + * + * List inbox tracking pixels + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageTrackingPixelProjection + */ + public function listInboxTrackingPixels($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0]) + { + list($response) = $this->listInboxTrackingPixelsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation listInboxTrackingPixelsWithHttpInfo + * + * List inbox tracking pixels + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function listInboxTrackingPixelsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0]) + { + $request = $this->listInboxTrackingPixelsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageTrackingPixelProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listInboxTrackingPixelsAsync + * + * List inbox tracking pixels + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listInboxTrackingPixelsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0]) + { + return $this->listInboxTrackingPixelsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listInboxTrackingPixelsAsyncWithHttpInfo + * + * List inbox tracking pixels + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listInboxTrackingPixelsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0]) + { + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + $request = $this->listInboxTrackingPixelsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listInboxTrackingPixels' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Optional filter by created after given date time (optional) + * @param \DateTime $before Optional filter by created before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listInboxTrackingPixelsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling listInboxTrackingPixels' + ); + } + + + + + + + + + $resourcePath = '/inboxes/{inboxId}/tracking-pixels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendEmail + * + * Send Email + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendEmail($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0]) + { + $this->sendEmailWithHttpInfo($inbox_id, $send_email_options, $contentType); + } + + /** + * Operation sendEmailWithHttpInfo + * + * Send Email + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0]) + { + $request = $this->sendEmailRequest($inbox_id, $send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation sendEmailAsync + * + * Send Email + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailAsync($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0]) + { + return $this->sendEmailAsyncWithHttpInfo($inbox_id, $send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendEmailAsyncWithHttpInfo + * + * Send Email + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailAsyncWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0]) + { + $returnType = ''; + $request = $this->sendEmailRequest($inbox_id, $send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendEmail' + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendEmailRequest($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendEmail' + ); + } + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendEmail' + ); + } + + + $resourcePath = '/inboxes/{inboxId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendEmailAndConfirm + * + * Send email and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function sendEmailAndConfirm($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0]) + { + list($response) = $this->sendEmailAndConfirmWithHttpInfo($inbox_id, $send_email_options, $contentType); + return $response; + } + + /** + * Operation sendEmailAndConfirmWithHttpInfo + * + * Send email and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailAndConfirmWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0]) + { + $request = $this->sendEmailAndConfirmRequest($inbox_id, $send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendEmailAndConfirmAsync + * + * Send email and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailAndConfirmAsync($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0]) + { + return $this->sendEmailAndConfirmAsyncWithHttpInfo($inbox_id, $send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendEmailAndConfirmAsyncWithHttpInfo + * + * Send email and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailAndConfirmAsyncWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->sendEmailAndConfirmRequest($inbox_id, $send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendEmailAndConfirm' + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendEmailAndConfirmRequest($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendEmailAndConfirm' + ); + } + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendEmailAndConfirm' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/confirm'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendEmailWithQueue + * + * Send email with queue + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param bool $validate_before_enqueue Validate before adding to queue (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendEmailWithQueue($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0]) + { + $this->sendEmailWithQueueWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, $contentType); + } + + /** + * Operation sendEmailWithQueueWithHttpInfo + * + * Send email with queue + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param bool $validate_before_enqueue Validate before adding to queue (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailWithQueueWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0]) + { + $request = $this->sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation sendEmailWithQueueAsync + * + * Send email with queue + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param bool $validate_before_enqueue Validate before adding to queue (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailWithQueueAsync($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0]) + { + return $this->sendEmailWithQueueAsyncWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendEmailWithQueueAsyncWithHttpInfo + * + * Send email with queue + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param bool $validate_before_enqueue Validate before adding to queue (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendEmailWithQueueAsyncWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0]) + { + $returnType = ''; + $request = $this->sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendEmailWithQueue' + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param bool $validate_before_enqueue Validate before adding to queue (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendEmailWithQueue' + ); + } + + // verify the required parameter 'validate_before_enqueue' is set + if ($validate_before_enqueue === null || (is_array($validate_before_enqueue) && count($validate_before_enqueue) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validate_before_enqueue when calling sendEmailWithQueue' + ); + } + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendEmailWithQueue' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/with-queue'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $validate_before_enqueue, + 'validateBeforeEnqueue', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendSmtpEnvelope + * + * Send email using an SMTP mail envelope and message body and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options send_smtp_envelope_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function sendSmtpEnvelope($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0]) + { + list($response) = $this->sendSmtpEnvelopeWithHttpInfo($inbox_id, $send_smtp_envelope_options, $contentType); + return $response; + } + + /** + * Operation sendSmtpEnvelopeWithHttpInfo + * + * Send email using an SMTP mail envelope and message body and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function sendSmtpEnvelopeWithHttpInfo($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0]) + { + $request = $this->sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendSmtpEnvelopeAsync + * + * Send email using an SMTP mail envelope and message body and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendSmtpEnvelopeAsync($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0]) + { + return $this->sendSmtpEnvelopeAsyncWithHttpInfo($inbox_id, $send_smtp_envelope_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendSmtpEnvelopeAsyncWithHttpInfo + * + * Send email using an SMTP mail envelope and message body and return sent confirmation + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendSmtpEnvelopeAsyncWithHttpInfo($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendSmtpEnvelope' + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendSmtpEnvelope' + ); + } + + // verify the required parameter 'send_smtp_envelope_options' is set + if ($send_smtp_envelope_options === null || (is_array($send_smtp_envelope_options) && count($send_smtp_envelope_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_smtp_envelope_options when calling sendSmtpEnvelope' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/smtp-envelope'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_smtp_envelope_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_smtp_envelope_options)); + } else { + $httpBody = $send_smtp_envelope_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendTestEmail + * + * Send a test email to inbox + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendTestEmail($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0]) + { + $this->sendTestEmailWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation sendTestEmailWithHttpInfo + * + * Send a test email to inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendTestEmailWithHttpInfo($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0]) + { + $request = $this->sendTestEmailRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation sendTestEmailAsync + * + * Send a test email to inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTestEmailAsync($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0]) + { + return $this->sendTestEmailAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendTestEmailAsyncWithHttpInfo + * + * Send a test email to inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTestEmailAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0]) + { + $returnType = ''; + $request = $this->sendTestEmailRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendTestEmail' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendTestEmailRequest($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendTestEmail' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/send-test-email'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendWithSchedule + * + * Send email with with delay or schedule + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required) + * @param \DateTime $send_at_timestamp Sending timestamp (optional) + * @param int $send_at_now_plus_seconds Send after n seconds (optional) + * @param bool $validate_before_enqueue Validate before adding to queue (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\ScheduledJobDto + */ + public function sendWithSchedule($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0]) + { + list($response) = $this->sendWithScheduleWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType); + return $response; + } + + /** + * Operation sendWithScheduleWithHttpInfo + * + * Send email with with delay or schedule + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param \DateTime $send_at_timestamp Sending timestamp (optional) + * @param int $send_at_now_plus_seconds Send after n seconds (optional) + * @param bool $validate_before_enqueue Validate before adding to queue (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings) + */ + public function sendWithScheduleWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0]) + { + $request = $this->sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\ScheduledJobDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendWithScheduleAsync + * + * Send email with with delay or schedule + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param \DateTime $send_at_timestamp Sending timestamp (optional) + * @param int $send_at_now_plus_seconds Send after n seconds (optional) + * @param bool $validate_before_enqueue Validate before adding to queue (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendWithScheduleAsync($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0]) + { + return $this->sendWithScheduleAsyncWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendWithScheduleAsyncWithHttpInfo + * + * Send email with with delay or schedule + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param \DateTime $send_at_timestamp Sending timestamp (optional) + * @param int $send_at_now_plus_seconds Send after n seconds (optional) + * @param bool $validate_before_enqueue Validate before adding to queue (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendWithScheduleAsyncWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0]) + { + $returnType = '\MailSlurp\Models\ScheduledJobDto'; + $request = $this->sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendWithSchedule' + * + * @param string $inbox_id ID of the inbox you want to send the email from (required) + * @param \MailSlurp\Models\SendEmailOptions $send_email_options (required) + * @param \DateTime $send_at_timestamp Sending timestamp (optional) + * @param int $send_at_now_plus_seconds Send after n seconds (optional) + * @param bool $validate_before_enqueue Validate before adding to queue (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling sendWithSchedule' + ); + } + + // verify the required parameter 'send_email_options' is set + if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $send_email_options when calling sendWithSchedule' + ); + } + + + + + + $resourcePath = '/inboxes/{inboxId}/with-schedule'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $send_at_timestamp, + 'sendAtTimestamp', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $send_at_now_plus_seconds, + 'sendAtNowPlusSeconds', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $validate_before_enqueue, + 'validateBeforeEnqueue', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($send_email_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options)); + } else { + $httpBody = $send_email_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation setInboxFavourited + * + * Set inbox favourited state + * + * @param string $inbox_id ID of inbox to set favourite state (required) + * @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options set_inbox_favourited_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function setInboxFavourited($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0]) + { + list($response) = $this->setInboxFavouritedWithHttpInfo($inbox_id, $set_inbox_favourited_options, $contentType); + return $response; + } + + /** + * Operation setInboxFavouritedWithHttpInfo + * + * Set inbox favourited state + * + * @param string $inbox_id ID of inbox to set favourite state (required) + * @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function setInboxFavouritedWithHttpInfo($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0]) + { + $request = $this->setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation setInboxFavouritedAsync + * + * Set inbox favourited state + * + * @param string $inbox_id ID of inbox to set favourite state (required) + * @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function setInboxFavouritedAsync($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0]) + { + return $this->setInboxFavouritedAsyncWithHttpInfo($inbox_id, $set_inbox_favourited_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation setInboxFavouritedAsyncWithHttpInfo + * + * Set inbox favourited state + * + * @param string $inbox_id ID of inbox to set favourite state (required) + * @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function setInboxFavouritedAsyncWithHttpInfo($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'setInboxFavourited' + * + * @param string $inbox_id ID of inbox to set favourite state (required) + * @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling setInboxFavourited' + ); + } + + // verify the required parameter 'set_inbox_favourited_options' is set + if ($set_inbox_favourited_options === null || (is_array($set_inbox_favourited_options) && count($set_inbox_favourited_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $set_inbox_favourited_options when calling setInboxFavourited' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/favourite'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($set_inbox_favourited_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($set_inbox_favourited_options)); + } else { + $httpBody = $set_inbox_favourited_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateInbox + * + * Update Inbox. Change name and description. Email address is not editable. + * + * @param string $inbox_id inbox_id (required) + * @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options update_inbox_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxDto + */ + public function updateInbox($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0]) + { + list($response) = $this->updateInboxWithHttpInfo($inbox_id, $update_inbox_options, $contentType); + return $response; + } + + /** + * Operation updateInboxWithHttpInfo + * + * Update Inbox. Change name and description. Email address is not editable. + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateInboxWithHttpInfo($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0]) + { + $request = $this->updateInboxRequest($inbox_id, $update_inbox_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateInboxAsync + * + * Update Inbox. Change name and description. Email address is not editable. + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateInboxAsync($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0]) + { + return $this->updateInboxAsyncWithHttpInfo($inbox_id, $update_inbox_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateInboxAsyncWithHttpInfo + * + * Update Inbox. Change name and description. Email address is not editable. + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateInboxAsyncWithHttpInfo($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxDto'; + $request = $this->updateInboxRequest($inbox_id, $update_inbox_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateInbox' + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateInboxRequest($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling updateInbox' + ); + } + + // verify the required parameter 'update_inbox_options' is set + if ($update_inbox_options === null || (is_array($update_inbox_options) && count($update_inbox_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_inbox_options when calling updateInbox' + ); + } + + + $resourcePath = '/inboxes/{inboxId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_inbox_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_inbox_options)); + } else { + $httpBody = $update_inbox_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/InboxForwarderControllerApi.php b/lib/Apis/InboxForwarderControllerApi.php new file mode 100644 index 00000000..e0599a92 --- /dev/null +++ b/lib/Apis/InboxForwarderControllerApi.php @@ -0,0 +1,3145 @@ + [ + 'application/json', + ], + 'deleteInboxForwarder' => [ + 'application/json', + ], + 'deleteInboxForwarders' => [ + 'application/json', + ], + 'getInboxForwarder' => [ + 'application/json', + ], + 'getInboxForwarderEvents' => [ + 'application/json', + ], + 'getInboxForwarders' => [ + 'application/json', + ], + 'testInboxForwarder' => [ + 'application/json', + ], + 'testInboxForwardersForInbox' => [ + 'application/json', + ], + 'testNewInboxForwarder' => [ + 'application/json', + ], + 'updateInboxForwarder' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createNewInboxForwarder + * + * Create an inbox forwarder + * + * @param string $inbox_id Inbox id to attach forwarder to (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderDto + */ + public function createNewInboxForwarder($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0]) + { + list($response) = $this->createNewInboxForwarderWithHttpInfo($inbox_id, $create_inbox_forwarder_options, $contentType); + return $response; + } + + /** + * Operation createNewInboxForwarderWithHttpInfo + * + * Create an inbox forwarder + * + * @param string $inbox_id Inbox id to attach forwarder to (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createNewInboxForwarderWithHttpInfo($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0]) + { + $request = $this->createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createNewInboxForwarderAsync + * + * Create an inbox forwarder + * + * @param string $inbox_id Inbox id to attach forwarder to (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewInboxForwarderAsync($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0]) + { + return $this->createNewInboxForwarderAsyncWithHttpInfo($inbox_id, $create_inbox_forwarder_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createNewInboxForwarderAsyncWithHttpInfo + * + * Create an inbox forwarder + * + * @param string $inbox_id Inbox id to attach forwarder to (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewInboxForwarderAsyncWithHttpInfo($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + $request = $this->createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createNewInboxForwarder' + * + * @param string $inbox_id Inbox id to attach forwarder to (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling createNewInboxForwarder' + ); + } + + // verify the required parameter 'create_inbox_forwarder_options' is set + if ($create_inbox_forwarder_options === null || (is_array($create_inbox_forwarder_options) && count($create_inbox_forwarder_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_inbox_forwarder_options when calling createNewInboxForwarder' + ); + } + + + $resourcePath = '/forwarders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_inbox_forwarder_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_forwarder_options)); + } else { + $httpBody = $create_inbox_forwarder_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteInboxForwarder + * + * Delete an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteInboxForwarder($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0]) + { + $this->deleteInboxForwarderWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteInboxForwarderWithHttpInfo + * + * Delete an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInboxForwarderWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0]) + { + $request = $this->deleteInboxForwarderRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteInboxForwarderAsync + * + * Delete an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxForwarderAsync($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0]) + { + return $this->deleteInboxForwarderAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInboxForwarderAsyncWithHttpInfo + * + * Delete an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxForwarderAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0]) + { + $returnType = ''; + $request = $this->deleteInboxForwarderRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteInboxForwarder' + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteInboxForwarderRequest($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteInboxForwarder' + ); + } + + + $resourcePath = '/forwarders/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteInboxForwarders + * + * Delete inbox forwarders + * + * @param string $inbox_id Optional inbox id to attach forwarder to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteInboxForwarders($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0]) + { + $this->deleteInboxForwardersWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation deleteInboxForwardersWithHttpInfo + * + * Delete inbox forwarders + * + * @param string $inbox_id Optional inbox id to attach forwarder to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInboxForwardersWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0]) + { + $request = $this->deleteInboxForwardersRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteInboxForwardersAsync + * + * Delete inbox forwarders + * + * @param string $inbox_id Optional inbox id to attach forwarder to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxForwardersAsync($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0]) + { + return $this->deleteInboxForwardersAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInboxForwardersAsyncWithHttpInfo + * + * Delete inbox forwarders + * + * @param string $inbox_id Optional inbox id to attach forwarder to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxForwardersAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0]) + { + $returnType = ''; + $request = $this->deleteInboxForwardersRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteInboxForwarders' + * + * @param string $inbox_id Optional inbox id to attach forwarder to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteInboxForwardersRequest($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0]) + { + + + + $resourcePath = '/forwarders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxForwarder + * + * Get an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderDto + */ + public function getInboxForwarder($id, string $contentType = self::contentTypes['getInboxForwarder'][0]) + { + list($response) = $this->getInboxForwarderWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getInboxForwarderWithHttpInfo + * + * Get an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxForwarderWithHttpInfo($id, string $contentType = self::contentTypes['getInboxForwarder'][0]) + { + $request = $this->getInboxForwarderRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxForwarderAsync + * + * Get an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwarderAsync($id, string $contentType = self::contentTypes['getInboxForwarder'][0]) + { + return $this->getInboxForwarderAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxForwarderAsyncWithHttpInfo + * + * Get an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwarderAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getInboxForwarder'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + $request = $this->getInboxForwarderRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxForwarder' + * + * @param string $id ID of inbox forwarder (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxForwarderRequest($id, string $contentType = self::contentTypes['getInboxForwarder'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getInboxForwarder' + ); + } + + + $resourcePath = '/forwarders/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxForwarderEvents + * + * Get an inbox forwarder event list + * + * @param string $id ID of inbox forwarder (required) + * @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageInboxForwarderEvents + */ + public function getInboxForwarderEvents($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0]) + { + list($response) = $this->getInboxForwarderEventsWithHttpInfo($id, $page, $size, $sort, $contentType); + return $response; + } + + /** + * Operation getInboxForwarderEventsWithHttpInfo + * + * Get an inbox forwarder event list + * + * @param string $id ID of inbox forwarder (required) + * @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageInboxForwarderEvents, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxForwarderEventsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0]) + { + $request = $this->getInboxForwarderEventsRequest($id, $page, $size, $sort, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageInboxForwarderEvents' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageInboxForwarderEvents' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxForwarderEvents', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageInboxForwarderEvents'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageInboxForwarderEvents', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxForwarderEventsAsync + * + * Get an inbox forwarder event list + * + * @param string $id ID of inbox forwarder (required) + * @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwarderEventsAsync($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0]) + { + return $this->getInboxForwarderEventsAsyncWithHttpInfo($id, $page, $size, $sort, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxForwarderEventsAsyncWithHttpInfo + * + * Get an inbox forwarder event list + * + * @param string $id ID of inbox forwarder (required) + * @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwarderEventsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0]) + { + $returnType = '\MailSlurp\Models\PageInboxForwarderEvents'; + $request = $this->getInboxForwarderEventsRequest($id, $page, $size, $sort, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxForwarderEvents' + * + * @param string $id ID of inbox forwarder (required) + * @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxForwarderEventsRequest($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getInboxForwarderEvents' + ); + } + + + + + + $resourcePath = '/forwarders/{id}/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxForwarders + * + * List inbox forwarders + * + * @param string $inbox_id Optional inbox id to get forwarders from (optional) + * @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageInboxForwarderDto + */ + public function getInboxForwarders($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0]) + { + list($response) = $this->getInboxForwardersWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxForwardersWithHttpInfo + * + * List inbox forwarders + * + * @param string $inbox_id Optional inbox id to get forwarders from (optional) + * @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageInboxForwarderDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxForwardersWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0]) + { + $request = $this->getInboxForwardersRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageInboxForwarderDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageInboxForwarderDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxForwarderDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageInboxForwarderDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageInboxForwarderDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxForwardersAsync + * + * List inbox forwarders + * + * @param string $inbox_id Optional inbox id to get forwarders from (optional) + * @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwardersAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0]) + { + return $this->getInboxForwardersAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxForwardersAsyncWithHttpInfo + * + * List inbox forwarders + * + * @param string $inbox_id Optional inbox id to get forwarders from (optional) + * @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxForwardersAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0]) + { + $returnType = '\MailSlurp\Models\PageInboxForwarderDto'; + $request = $this->getInboxForwardersRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxForwarders' + * + * @param string $inbox_id Optional inbox id to get forwarders from (optional) + * @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0) + * @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxForwardersRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0]) + { + + + + + + + + + + $resourcePath = '/forwarders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testInboxForwarder + * + * Test an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderTestResult + */ + public function testInboxForwarder($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0]) + { + list($response) = $this->testInboxForwarderWithHttpInfo($id, $inbox_forwarder_test_options, $contentType); + return $response; + } + + /** + * Operation testInboxForwarderWithHttpInfo + * + * Test an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testInboxForwarderWithHttpInfo($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0]) + { + $request = $this->testInboxForwarderRequest($id, $inbox_forwarder_test_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testInboxForwarderAsync + * + * Test an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxForwarderAsync($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0]) + { + return $this->testInboxForwarderAsyncWithHttpInfo($id, $inbox_forwarder_test_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testInboxForwarderAsyncWithHttpInfo + * + * Test an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxForwarderAsyncWithHttpInfo($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + $request = $this->testInboxForwarderRequest($id, $inbox_forwarder_test_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testInboxForwarder' + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testInboxForwarderRequest($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling testInboxForwarder' + ); + } + + // verify the required parameter 'inbox_forwarder_test_options' is set + if ($inbox_forwarder_test_options === null || (is_array($inbox_forwarder_test_options) && count($inbox_forwarder_test_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_forwarder_test_options when calling testInboxForwarder' + ); + } + + + $resourcePath = '/forwarders/{id}/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($inbox_forwarder_test_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_forwarder_test_options)); + } else { + $httpBody = $inbox_forwarder_test_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testInboxForwardersForInbox + * + * Test inbox forwarders for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderTestResult + */ + public function testInboxForwardersForInbox($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0]) + { + list($response) = $this->testInboxForwardersForInboxWithHttpInfo($inbox_id, $inbox_forwarder_test_options, $contentType); + return $response; + } + + /** + * Operation testInboxForwardersForInboxWithHttpInfo + * + * Test inbox forwarders for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testInboxForwardersForInboxWithHttpInfo($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0]) + { + $request = $this->testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testInboxForwardersForInboxAsync + * + * Test inbox forwarders for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxForwardersForInboxAsync($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0]) + { + return $this->testInboxForwardersForInboxAsyncWithHttpInfo($inbox_id, $inbox_forwarder_test_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testInboxForwardersForInboxAsyncWithHttpInfo + * + * Test inbox forwarders for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxForwardersForInboxAsyncWithHttpInfo($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + $request = $this->testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testInboxForwardersForInbox' + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling testInboxForwardersForInbox' + ); + } + + // verify the required parameter 'inbox_forwarder_test_options' is set + if ($inbox_forwarder_test_options === null || (is_array($inbox_forwarder_test_options) && count($inbox_forwarder_test_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_forwarder_test_options when calling testInboxForwardersForInbox' + ); + } + + + $resourcePath = '/forwarders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($inbox_forwarder_test_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_forwarder_test_options)); + } else { + $httpBody = $inbox_forwarder_test_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testNewInboxForwarder + * + * Test new inbox forwarder + * + * @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options test_new_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderTestResult + */ + public function testNewInboxForwarder($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0]) + { + list($response) = $this->testNewInboxForwarderWithHttpInfo($test_new_inbox_forwarder_options, $contentType); + return $response; + } + + /** + * Operation testNewInboxForwarderWithHttpInfo + * + * Test new inbox forwarder + * + * @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testNewInboxForwarderWithHttpInfo($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0]) + { + $request = $this->testNewInboxForwarderRequest($test_new_inbox_forwarder_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testNewInboxForwarderAsync + * + * Test new inbox forwarder + * + * @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testNewInboxForwarderAsync($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0]) + { + return $this->testNewInboxForwarderAsyncWithHttpInfo($test_new_inbox_forwarder_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testNewInboxForwarderAsyncWithHttpInfo + * + * Test new inbox forwarder + * + * @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testNewInboxForwarderAsyncWithHttpInfo($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderTestResult'; + $request = $this->testNewInboxForwarderRequest($test_new_inbox_forwarder_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testNewInboxForwarder' + * + * @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testNewInboxForwarderRequest($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0]) + { + + // verify the required parameter 'test_new_inbox_forwarder_options' is set + if ($test_new_inbox_forwarder_options === null || (is_array($test_new_inbox_forwarder_options) && count($test_new_inbox_forwarder_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $test_new_inbox_forwarder_options when calling testNewInboxForwarder' + ); + } + + + $resourcePath = '/forwarders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($test_new_inbox_forwarder_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_new_inbox_forwarder_options)); + } else { + $httpBody = $test_new_inbox_forwarder_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateInboxForwarder + * + * Update an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxForwarderDto + */ + public function updateInboxForwarder($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0]) + { + list($response) = $this->updateInboxForwarderWithHttpInfo($id, $create_inbox_forwarder_options, $contentType); + return $response; + } + + /** + * Operation updateInboxForwarderWithHttpInfo + * + * Update an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateInboxForwarderWithHttpInfo($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0]) + { + $request = $this->updateInboxForwarderRequest($id, $create_inbox_forwarder_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxForwarderDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateInboxForwarderAsync + * + * Update an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateInboxForwarderAsync($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0]) + { + return $this->updateInboxForwarderAsyncWithHttpInfo($id, $create_inbox_forwarder_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateInboxForwarderAsyncWithHttpInfo + * + * Update an inbox forwarder + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateInboxForwarderAsyncWithHttpInfo($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0]) + { + $returnType = '\MailSlurp\Models\InboxForwarderDto'; + $request = $this->updateInboxForwarderRequest($id, $create_inbox_forwarder_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateInboxForwarder' + * + * @param string $id ID of inbox forwarder (required) + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateInboxForwarderRequest($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateInboxForwarder' + ); + } + + // verify the required parameter 'create_inbox_forwarder_options' is set + if ($create_inbox_forwarder_options === null || (is_array($create_inbox_forwarder_options) && count($create_inbox_forwarder_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_inbox_forwarder_options when calling updateInboxForwarder' + ); + } + + + $resourcePath = '/forwarders/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_inbox_forwarder_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_forwarder_options)); + } else { + $httpBody = $create_inbox_forwarder_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/InboxRulesetControllerApi.php b/lib/Apis/InboxRulesetControllerApi.php new file mode 100644 index 00000000..12c8608c --- /dev/null +++ b/lib/Apis/InboxRulesetControllerApi.php @@ -0,0 +1,2499 @@ + [ + 'application/json', + ], + 'deleteInboxRuleset' => [ + 'application/json', + ], + 'deleteInboxRulesets' => [ + 'application/json', + ], + 'getInboxRuleset' => [ + 'application/json', + ], + 'getInboxRulesets' => [ + 'application/json', + ], + 'testInboxRuleset' => [ + 'application/json', + ], + 'testInboxRulesetsForInbox' => [ + 'application/json', + ], + 'testNewInboxRuleset' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createNewInboxRuleset + * + * Create an inbox ruleset + * + * @param string $inbox_id Inbox id to attach ruleset to (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetDto + */ + public function createNewInboxRuleset($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createNewInboxRuleset'][0]) + { + list($response) = $this->createNewInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType); + return $response; + } + + /** + * Operation createNewInboxRulesetWithHttpInfo + * + * Create an inbox ruleset + * + * @param string $inbox_id Inbox id to attach ruleset to (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createNewInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createNewInboxRuleset'][0]) + { + $request = $this->createNewInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createNewInboxRulesetAsync + * + * Create an inbox ruleset + * + * @param string $inbox_id Inbox id to attach ruleset to (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewInboxRulesetAsync($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createNewInboxRuleset'][0]) + { + return $this->createNewInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createNewInboxRulesetAsyncWithHttpInfo + * + * Create an inbox ruleset + * + * @param string $inbox_id Inbox id to attach ruleset to (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createNewInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createNewInboxRuleset'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + $request = $this->createNewInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createNewInboxRuleset' + * + * @param string $inbox_id Inbox id to attach ruleset to (required) + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createNewInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createNewInboxRuleset'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling createNewInboxRuleset' + ); + } + + // verify the required parameter 'create_inbox_ruleset_options' is set + if ($create_inbox_ruleset_options === null || (is_array($create_inbox_ruleset_options) && count($create_inbox_ruleset_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_inbox_ruleset_options when calling createNewInboxRuleset' + ); + } + + + $resourcePath = '/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_inbox_ruleset_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_ruleset_options)); + } else { + $httpBody = $create_inbox_ruleset_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteInboxRuleset + * + * Delete an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteInboxRuleset($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0]) + { + $this->deleteInboxRulesetWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteInboxRulesetWithHttpInfo + * + * Delete an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInboxRulesetWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0]) + { + $request = $this->deleteInboxRulesetRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteInboxRulesetAsync + * + * Delete an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxRulesetAsync($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0]) + { + return $this->deleteInboxRulesetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInboxRulesetAsyncWithHttpInfo + * + * Delete an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxRulesetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0]) + { + $returnType = ''; + $request = $this->deleteInboxRulesetRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteInboxRuleset' + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteInboxRulesetRequest($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteInboxRuleset' + ); + } + + + $resourcePath = '/rulesets/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteInboxRulesets + * + * Delete inbox rulesets + * + * @param string $inbox_id Optional inbox id to attach ruleset to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteInboxRulesets($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0]) + { + $this->deleteInboxRulesetsWithHttpInfo($inbox_id, $contentType); + } + + /** + * Operation deleteInboxRulesetsWithHttpInfo + * + * Delete inbox rulesets + * + * @param string $inbox_id Optional inbox id to attach ruleset to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInboxRulesetsWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0]) + { + $request = $this->deleteInboxRulesetsRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteInboxRulesetsAsync + * + * Delete inbox rulesets + * + * @param string $inbox_id Optional inbox id to attach ruleset to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxRulesetsAsync($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0]) + { + return $this->deleteInboxRulesetsAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInboxRulesetsAsyncWithHttpInfo + * + * Delete inbox rulesets + * + * @param string $inbox_id Optional inbox id to attach ruleset to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteInboxRulesetsAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0]) + { + $returnType = ''; + $request = $this->deleteInboxRulesetsRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteInboxRulesets' + * + * @param string $inbox_id Optional inbox id to attach ruleset to (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteInboxRulesetsRequest($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0]) + { + + + + $resourcePath = '/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxRuleset + * + * Get an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetDto + */ + public function getInboxRuleset($id, string $contentType = self::contentTypes['getInboxRuleset'][0]) + { + list($response) = $this->getInboxRulesetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getInboxRulesetWithHttpInfo + * + * Get an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxRulesetWithHttpInfo($id, string $contentType = self::contentTypes['getInboxRuleset'][0]) + { + $request = $this->getInboxRulesetRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxRulesetAsync + * + * Get an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxRulesetAsync($id, string $contentType = self::contentTypes['getInboxRuleset'][0]) + { + return $this->getInboxRulesetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxRulesetAsyncWithHttpInfo + * + * Get an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxRulesetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getInboxRuleset'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetDto'; + $request = $this->getInboxRulesetRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxRuleset' + * + * @param string $id ID of inbox ruleset (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxRulesetRequest($id, string $contentType = self::contentTypes['getInboxRuleset'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getInboxRuleset' + ); + } + + + $resourcePath = '/rulesets/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxRulesets + * + * List inbox rulesets + * + * @param string $inbox_id Optional inbox id to get rulesets from (optional) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageInboxRulesetDto + */ + public function getInboxRulesets($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0]) + { + list($response) = $this->getInboxRulesetsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxRulesetsWithHttpInfo + * + * List inbox rulesets + * + * @param string $inbox_id Optional inbox id to get rulesets from (optional) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageInboxRulesetDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxRulesetsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0]) + { + $request = $this->getInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageInboxRulesetDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageInboxRulesetDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxRulesetDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageInboxRulesetDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageInboxRulesetDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxRulesetsAsync + * + * List inbox rulesets + * + * @param string $inbox_id Optional inbox id to get rulesets from (optional) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxRulesetsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0]) + { + return $this->getInboxRulesetsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxRulesetsAsyncWithHttpInfo + * + * List inbox rulesets + * + * @param string $inbox_id Optional inbox id to get rulesets from (optional) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxRulesetsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0]) + { + $returnType = '\MailSlurp\Models\PageInboxRulesetDto'; + $request = $this->getInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxRulesets' + * + * @param string $inbox_id Optional inbox id to get rulesets from (optional) + * @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0) + * @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxRulesetsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0]) + { + + + + + + + + + + $resourcePath = '/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testInboxRuleset + * + * Test an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetTestResult + */ + public function testInboxRuleset($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0]) + { + list($response) = $this->testInboxRulesetWithHttpInfo($id, $inbox_ruleset_test_options, $contentType); + return $response; + } + + /** + * Operation testInboxRulesetWithHttpInfo + * + * Test an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testInboxRulesetWithHttpInfo($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0]) + { + $request = $this->testInboxRulesetRequest($id, $inbox_ruleset_test_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testInboxRulesetAsync + * + * Test an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxRulesetAsync($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0]) + { + return $this->testInboxRulesetAsyncWithHttpInfo($id, $inbox_ruleset_test_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testInboxRulesetAsyncWithHttpInfo + * + * Test an inbox ruleset + * + * @param string $id ID of inbox ruleset (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxRulesetAsyncWithHttpInfo($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + $request = $this->testInboxRulesetRequest($id, $inbox_ruleset_test_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testInboxRuleset' + * + * @param string $id ID of inbox ruleset (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testInboxRulesetRequest($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling testInboxRuleset' + ); + } + + // verify the required parameter 'inbox_ruleset_test_options' is set + if ($inbox_ruleset_test_options === null || (is_array($inbox_ruleset_test_options) && count($inbox_ruleset_test_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_ruleset_test_options when calling testInboxRuleset' + ); + } + + + $resourcePath = '/rulesets/{id}/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($inbox_ruleset_test_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_ruleset_test_options)); + } else { + $httpBody = $inbox_ruleset_test_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testInboxRulesetsForInbox + * + * Test inbox rulesets for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetTestResult + */ + public function testInboxRulesetsForInbox($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0]) + { + list($response) = $this->testInboxRulesetsForInboxWithHttpInfo($inbox_id, $inbox_ruleset_test_options, $contentType); + return $response; + } + + /** + * Operation testInboxRulesetsForInboxWithHttpInfo + * + * Test inbox rulesets for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testInboxRulesetsForInboxWithHttpInfo($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0]) + { + $request = $this->testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testInboxRulesetsForInboxAsync + * + * Test inbox rulesets for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxRulesetsForInboxAsync($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0]) + { + return $this->testInboxRulesetsForInboxAsyncWithHttpInfo($inbox_id, $inbox_ruleset_test_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testInboxRulesetsForInboxAsyncWithHttpInfo + * + * Test inbox rulesets for inbox + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInboxRulesetsForInboxAsyncWithHttpInfo($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + $request = $this->testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testInboxRulesetsForInbox' + * + * @param string $inbox_id ID of inbox (required) + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling testInboxRulesetsForInbox' + ); + } + + // verify the required parameter 'inbox_ruleset_test_options' is set + if ($inbox_ruleset_test_options === null || (is_array($inbox_ruleset_test_options) && count($inbox_ruleset_test_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_ruleset_test_options when calling testInboxRulesetsForInbox' + ); + } + + + $resourcePath = '/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($inbox_ruleset_test_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_ruleset_test_options)); + } else { + $httpBody = $inbox_ruleset_test_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testNewInboxRuleset + * + * Test new inbox ruleset + * + * @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options test_new_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\InboxRulesetTestResult + */ + public function testNewInboxRuleset($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0]) + { + list($response) = $this->testNewInboxRulesetWithHttpInfo($test_new_inbox_ruleset_options, $contentType); + return $response; + } + + /** + * Operation testNewInboxRulesetWithHttpInfo + * + * Test new inbox ruleset + * + * @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function testNewInboxRulesetWithHttpInfo($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0]) + { + $request = $this->testNewInboxRulesetRequest($test_new_inbox_ruleset_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\InboxRulesetTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testNewInboxRulesetAsync + * + * Test new inbox ruleset + * + * @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testNewInboxRulesetAsync($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0]) + { + return $this->testNewInboxRulesetAsyncWithHttpInfo($test_new_inbox_ruleset_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testNewInboxRulesetAsyncWithHttpInfo + * + * Test new inbox ruleset + * + * @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testNewInboxRulesetAsyncWithHttpInfo($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0]) + { + $returnType = '\MailSlurp\Models\InboxRulesetTestResult'; + $request = $this->testNewInboxRulesetRequest($test_new_inbox_ruleset_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testNewInboxRuleset' + * + * @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testNewInboxRulesetRequest($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0]) + { + + // verify the required parameter 'test_new_inbox_ruleset_options' is set + if ($test_new_inbox_ruleset_options === null || (is_array($test_new_inbox_ruleset_options) && count($test_new_inbox_ruleset_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $test_new_inbox_ruleset_options when calling testNewInboxRuleset' + ); + } + + + $resourcePath = '/rulesets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($test_new_inbox_ruleset_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_new_inbox_ruleset_options)); + } else { + $httpBody = $test_new_inbox_ruleset_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/MailServerControllerApi.php b/lib/Apis/MailServerControllerApi.php new file mode 100644 index 00000000..7e9cf68c --- /dev/null +++ b/lib/Apis/MailServerControllerApi.php @@ -0,0 +1,1308 @@ + [ + 'application/json', + ], + 'getDnsLookup' => [ + 'application/json', + ], + 'getIpAddress' => [ + 'application/json', + ], + 'verifyEmailAddress' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation describeMailServerDomain + * + * Get DNS Mail Server records for a domain + * + * @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options describe_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DescribeMailServerDomainResult + */ + public function describeMailServerDomain($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0]) + { + list($response) = $this->describeMailServerDomainWithHttpInfo($describe_domain_options, $contentType); + return $response; + } + + /** + * Operation describeMailServerDomainWithHttpInfo + * + * Get DNS Mail Server records for a domain + * + * @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DescribeMailServerDomainResult, HTTP status code, HTTP response headers (array of strings) + */ + public function describeMailServerDomainWithHttpInfo($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0]) + { + $request = $this->describeMailServerDomainRequest($describe_domain_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DescribeMailServerDomainResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DescribeMailServerDomainResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DescribeMailServerDomainResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DescribeMailServerDomainResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DescribeMailServerDomainResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation describeMailServerDomainAsync + * + * Get DNS Mail Server records for a domain + * + * @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function describeMailServerDomainAsync($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0]) + { + return $this->describeMailServerDomainAsyncWithHttpInfo($describe_domain_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation describeMailServerDomainAsyncWithHttpInfo + * + * Get DNS Mail Server records for a domain + * + * @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function describeMailServerDomainAsyncWithHttpInfo($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0]) + { + $returnType = '\MailSlurp\Models\DescribeMailServerDomainResult'; + $request = $this->describeMailServerDomainRequest($describe_domain_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'describeMailServerDomain' + * + * @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function describeMailServerDomainRequest($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0]) + { + + // verify the required parameter 'describe_domain_options' is set + if ($describe_domain_options === null || (is_array($describe_domain_options) && count($describe_domain_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $describe_domain_options when calling describeMailServerDomain' + ); + } + + + $resourcePath = '/mail-server/describe/domain'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($describe_domain_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($describe_domain_options)); + } else { + $httpBody = $describe_domain_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getDnsLookup + * + * Lookup DNS records for a domain + * + * @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options dns_lookup_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DNSLookupResults + */ + public function getDnsLookup($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0]) + { + list($response) = $this->getDnsLookupWithHttpInfo($dns_lookup_options, $contentType); + return $response; + } + + /** + * Operation getDnsLookupWithHttpInfo + * + * Lookup DNS records for a domain + * + * @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DNSLookupResults, HTTP status code, HTTP response headers (array of strings) + */ + public function getDnsLookupWithHttpInfo($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0]) + { + $request = $this->getDnsLookupRequest($dns_lookup_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DNSLookupResults' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DNSLookupResults' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DNSLookupResults', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DNSLookupResults'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DNSLookupResults', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDnsLookupAsync + * + * Lookup DNS records for a domain + * + * @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDnsLookupAsync($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0]) + { + return $this->getDnsLookupAsyncWithHttpInfo($dns_lookup_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDnsLookupAsyncWithHttpInfo + * + * Lookup DNS records for a domain + * + * @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDnsLookupAsyncWithHttpInfo($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0]) + { + $returnType = '\MailSlurp\Models\DNSLookupResults'; + $request = $this->getDnsLookupRequest($dns_lookup_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDnsLookup' + * + * @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDnsLookupRequest($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0]) + { + + // verify the required parameter 'dns_lookup_options' is set + if ($dns_lookup_options === null || (is_array($dns_lookup_options) && count($dns_lookup_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dns_lookup_options when calling getDnsLookup' + ); + } + + + $resourcePath = '/mail-server/describe/dns-lookup'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($dns_lookup_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($dns_lookup_options)); + } else { + $httpBody = $dns_lookup_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getIpAddress + * + * Get IP address for a domain + * + * @param string $name name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\IPAddressResult + */ + public function getIpAddress($name, string $contentType = self::contentTypes['getIpAddress'][0]) + { + list($response) = $this->getIpAddressWithHttpInfo($name, $contentType); + return $response; + } + + /** + * Operation getIpAddressWithHttpInfo + * + * Get IP address for a domain + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\IPAddressResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getIpAddressWithHttpInfo($name, string $contentType = self::contentTypes['getIpAddress'][0]) + { + $request = $this->getIpAddressRequest($name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\IPAddressResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\IPAddressResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\IPAddressResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\IPAddressResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\IPAddressResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getIpAddressAsync + * + * Get IP address for a domain + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIpAddressAsync($name, string $contentType = self::contentTypes['getIpAddress'][0]) + { + return $this->getIpAddressAsyncWithHttpInfo($name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIpAddressAsyncWithHttpInfo + * + * Get IP address for a domain + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIpAddressAsyncWithHttpInfo($name, string $contentType = self::contentTypes['getIpAddress'][0]) + { + $returnType = '\MailSlurp\Models\IPAddressResult'; + $request = $this->getIpAddressRequest($name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getIpAddress' + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getIpAddressRequest($name, string $contentType = self::contentTypes['getIpAddress'][0]) + { + + // verify the required parameter 'name' is set + if ($name === null || (is_array($name) && count($name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $name when calling getIpAddress' + ); + } + + + $resourcePath = '/mail-server/describe/ip-address'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation verifyEmailAddress + * + * Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. + * + * @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options verify_email_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailVerificationResult + * @deprecated + */ + public function verifyEmailAddress($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0]) + { + list($response) = $this->verifyEmailAddressWithHttpInfo($verify_email_address_options, $contentType); + return $response; + } + + /** + * Operation verifyEmailAddressWithHttpInfo + * + * Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. + * + * @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailVerificationResult, HTTP status code, HTTP response headers (array of strings) + * @deprecated + */ + public function verifyEmailAddressWithHttpInfo($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0]) + { + $request = $this->verifyEmailAddressRequest($verify_email_address_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailVerificationResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailVerificationResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailVerificationResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailVerificationResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailVerificationResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation verifyEmailAddressAsync + * + * Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. + * + * @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function verifyEmailAddressAsync($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0]) + { + return $this->verifyEmailAddressAsyncWithHttpInfo($verify_email_address_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation verifyEmailAddressAsyncWithHttpInfo + * + * Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server. + * + * @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function verifyEmailAddressAsyncWithHttpInfo($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0]) + { + $returnType = '\MailSlurp\Models\EmailVerificationResult'; + $request = $this->verifyEmailAddressRequest($verify_email_address_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'verifyEmailAddress' + * + * @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function verifyEmailAddressRequest($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0]) + { + + // verify the required parameter 'verify_email_address_options' is set + if ($verify_email_address_options === null || (is_array($verify_email_address_options) && count($verify_email_address_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $verify_email_address_options when calling verifyEmailAddress' + ); + } + + + $resourcePath = '/mail-server/verify/email-address'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($verify_email_address_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($verify_email_address_options)); + } else { + $httpBody = $verify_email_address_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/MissedEmailControllerApi.php b/lib/Apis/MissedEmailControllerApi.php new file mode 100644 index 00000000..484532f1 --- /dev/null +++ b/lib/Apis/MissedEmailControllerApi.php @@ -0,0 +1,1759 @@ + [ + 'application/json', + ], + 'getAllUnknownMissedEmails' => [ + 'application/json', + ], + 'getMissedEmail' => [ + 'application/json', + ], + 'restoreMissedEmails' => [ + 'application/json', + ], + 'waitForNthMissedEmail' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getAllMissedEmails + * + * Get all MissedEmails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageMissedEmailProjection + */ + public function getAllMissedEmails($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0]) + { + list($response) = $this->getAllMissedEmailsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + return $response; + } + + /** + * Operation getAllMissedEmailsWithHttpInfo + * + * Get all MissedEmails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageMissedEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllMissedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0]) + { + $request = $this->getAllMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageMissedEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageMissedEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageMissedEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageMissedEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageMissedEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllMissedEmailsAsync + * + * Get all MissedEmails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllMissedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0]) + { + return $this->getAllMissedEmailsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllMissedEmailsAsyncWithHttpInfo + * + * Get all MissedEmails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllMissedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageMissedEmailProjection'; + $request = $this->getAllMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllMissedEmails' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllMissedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0]) + { + + + + + + + + + + $resourcePath = '/missed-emails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllUnknownMissedEmails + * + * Get all unknown missed emails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageUnknownMissedEmailProjection + */ + public function getAllUnknownMissedEmails($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0]) + { + list($response) = $this->getAllUnknownMissedEmailsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + return $response; + } + + /** + * Operation getAllUnknownMissedEmailsWithHttpInfo + * + * Get all unknown missed emails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageUnknownMissedEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllUnknownMissedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0]) + { + $request = $this->getAllUnknownMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageUnknownMissedEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageUnknownMissedEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageUnknownMissedEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageUnknownMissedEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageUnknownMissedEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllUnknownMissedEmailsAsync + * + * Get all unknown missed emails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllUnknownMissedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0]) + { + return $this->getAllUnknownMissedEmailsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllUnknownMissedEmailsAsyncWithHttpInfo + * + * Get all unknown missed emails in paginated format + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllUnknownMissedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageUnknownMissedEmailProjection'; + $request = $this->getAllUnknownMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllUnknownMissedEmails' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllUnknownMissedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0]) + { + + + + + + + + + + $resourcePath = '/missed-emails/unknown'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getMissedEmail + * + * Get MissedEmail + * + * @param string $missed_email_id missed_email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\MissedEmailDto + */ + public function getMissedEmail($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0]) + { + list($response) = $this->getMissedEmailWithHttpInfo($missed_email_id, $contentType); + return $response; + } + + /** + * Operation getMissedEmailWithHttpInfo + * + * Get MissedEmail + * + * @param string $missed_email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\MissedEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getMissedEmailWithHttpInfo($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0]) + { + $request = $this->getMissedEmailRequest($missed_email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\MissedEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\MissedEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\MissedEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\MissedEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\MissedEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getMissedEmailAsync + * + * Get MissedEmail + * + * @param string $missed_email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMissedEmailAsync($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0]) + { + return $this->getMissedEmailAsyncWithHttpInfo($missed_email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMissedEmailAsyncWithHttpInfo + * + * Get MissedEmail + * + * @param string $missed_email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMissedEmailAsyncWithHttpInfo($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0]) + { + $returnType = '\MailSlurp\Models\MissedEmailDto'; + $request = $this->getMissedEmailRequest($missed_email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getMissedEmail' + * + * @param string $missed_email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMissedEmailRequest($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0]) + { + + // verify the required parameter 'missed_email_id' is set + if ($missed_email_id === null || (is_array($missed_email_id) && count($missed_email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $missed_email_id when calling getMissedEmail' + ); + } + + + $resourcePath = '/missed-emails/{missedEmailId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($missed_email_id !== null) { + $resourcePath = str_replace( + '{' . 'missedEmailId' . '}', + ObjectSerializer::toPathValue($missed_email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation restoreMissedEmails + * + * Restore missed emails + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function restoreMissedEmails(string $contentType = self::contentTypes['restoreMissedEmails'][0]) + { + $this->restoreMissedEmailsWithHttpInfo($contentType); + } + + /** + * Operation restoreMissedEmailsWithHttpInfo + * + * Restore missed emails + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function restoreMissedEmailsWithHttpInfo(string $contentType = self::contentTypes['restoreMissedEmails'][0]) + { + $request = $this->restoreMissedEmailsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation restoreMissedEmailsAsync + * + * Restore missed emails + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreMissedEmailsAsync(string $contentType = self::contentTypes['restoreMissedEmails'][0]) + { + return $this->restoreMissedEmailsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation restoreMissedEmailsAsyncWithHttpInfo + * + * Restore missed emails + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function restoreMissedEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['restoreMissedEmails'][0]) + { + $returnType = ''; + $request = $this->restoreMissedEmailsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'restoreMissedEmails' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function restoreMissedEmailsRequest(string $contentType = self::contentTypes['restoreMissedEmails'][0]) + { + + + $resourcePath = '/missed-emails/restore'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForNthMissedEmail + * + * Wait for Nth missed email + * + * @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\MissedEmailDto + */ + public function waitForNthMissedEmail($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0]) + { + list($response) = $this->waitForNthMissedEmailWithHttpInfo($index, $inbox_id, $timeout, $since, $before, $contentType); + return $response; + } + + /** + * Operation waitForNthMissedEmailWithHttpInfo + * + * Wait for Nth missed email + * + * @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\MissedEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForNthMissedEmailWithHttpInfo($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0]) + { + $request = $this->waitForNthMissedEmailRequest($index, $inbox_id, $timeout, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\MissedEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\MissedEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\MissedEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\MissedEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\MissedEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForNthMissedEmailAsync + * + * Wait for Nth missed email + * + * @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForNthMissedEmailAsync($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0]) + { + return $this->waitForNthMissedEmailAsyncWithHttpInfo($index, $inbox_id, $timeout, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForNthMissedEmailAsyncWithHttpInfo + * + * Wait for Nth missed email + * + * @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForNthMissedEmailAsyncWithHttpInfo($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0]) + { + $returnType = '\MailSlurp\Models\MissedEmailDto'; + $request = $this->waitForNthMissedEmailRequest($index, $inbox_id, $timeout, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForNthMissedEmail' + * + * @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForNthMissedEmailRequest($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0]) + { + + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling waitForNthMissedEmail' + ); + } + if ($index > 2147483647) { + throw new \InvalidArgumentException('invalid value for "$index" when calling MissedEmailControllerApi.waitForNthMissedEmail, must be smaller than or equal to 2147483647.'); + } + if ($index < 0) { + throw new \InvalidArgumentException('invalid value for "$index" when calling MissedEmailControllerApi.waitForNthMissedEmail, must be bigger than or equal to 0.'); + } + + + + + + + $resourcePath = '/missed-emails/waitForNthMissedEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $index, + 'index', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/PhoneControllerApi.php b/lib/Apis/PhoneControllerApi.php new file mode 100644 index 00000000..97b73ae1 --- /dev/null +++ b/lib/Apis/PhoneControllerApi.php @@ -0,0 +1,2638 @@ + [ + 'application/json', + ], + 'deleteEmergencyAddress' => [ + 'application/json', + ], + 'deletePhoneNumber' => [ + 'application/json', + ], + 'getEmergencyAddress' => [ + 'application/json', + ], + 'getEmergencyAddresses' => [ + 'application/json', + ], + 'getPhoneNumber' => [ + 'application/json', + ], + 'getPhoneNumbers' => [ + 'application/json', + ], + 'getPhonePlans' => [ + 'application/json', + ], + 'testPhoneNumberSendSms' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createEmergencyAddress + * + * @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options create_emergency_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmergencyAddress + */ + public function createEmergencyAddress($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0]) + { + list($response) = $this->createEmergencyAddressWithHttpInfo($create_emergency_address_options, $contentType); + return $response; + } + + /** + * Operation createEmergencyAddressWithHttpInfo + * + * @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmergencyAddress, HTTP status code, HTTP response headers (array of strings) + */ + public function createEmergencyAddressWithHttpInfo($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0]) + { + $request = $this->createEmergencyAddressRequest($create_emergency_address_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmergencyAddress' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmergencyAddress' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddress', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmergencyAddress'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmergencyAddress', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createEmergencyAddressAsync + * + * @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEmergencyAddressAsync($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0]) + { + return $this->createEmergencyAddressAsyncWithHttpInfo($create_emergency_address_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEmergencyAddressAsyncWithHttpInfo + * + * @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEmergencyAddressAsyncWithHttpInfo($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0]) + { + $returnType = '\MailSlurp\Models\EmergencyAddress'; + $request = $this->createEmergencyAddressRequest($create_emergency_address_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createEmergencyAddress' + * + * @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEmergencyAddressRequest($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0]) + { + + // verify the required parameter 'create_emergency_address_options' is set + if ($create_emergency_address_options === null || (is_array($create_emergency_address_options) && count($create_emergency_address_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_emergency_address_options when calling createEmergencyAddress' + ); + } + + + $resourcePath = '/phone/emergency-addresses'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_emergency_address_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_emergency_address_options)); + } else { + $httpBody = $create_emergency_address_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteEmergencyAddress + * + * @param string $address_id address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmptyResponseDto + */ + public function deleteEmergencyAddress($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0]) + { + list($response) = $this->deleteEmergencyAddressWithHttpInfo($address_id, $contentType); + return $response; + } + + /** + * Operation deleteEmergencyAddressWithHttpInfo + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmptyResponseDto, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteEmergencyAddressWithHttpInfo($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0]) + { + $request = $this->deleteEmergencyAddressRequest($address_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmptyResponseDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmptyResponseDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmptyResponseDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmptyResponseDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmptyResponseDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteEmergencyAddressAsync + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmergencyAddressAsync($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0]) + { + return $this->deleteEmergencyAddressAsyncWithHttpInfo($address_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEmergencyAddressAsyncWithHttpInfo + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEmergencyAddressAsyncWithHttpInfo($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0]) + { + $returnType = '\MailSlurp\Models\EmptyResponseDto'; + $request = $this->deleteEmergencyAddressRequest($address_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteEmergencyAddress' + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEmergencyAddressRequest($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0]) + { + + // verify the required parameter 'address_id' is set + if ($address_id === null || (is_array($address_id) && count($address_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $address_id when calling deleteEmergencyAddress' + ); + } + + + $resourcePath = '/phone/emergency-addresses/{addressId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($address_id !== null) { + $resourcePath = str_replace( + '{' . 'addressId' . '}', + ObjectSerializer::toPathValue($address_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deletePhoneNumber + * + * @param string $phone_number_id phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deletePhoneNumber($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0]) + { + $this->deletePhoneNumberWithHttpInfo($phone_number_id, $contentType); + } + + /** + * Operation deletePhoneNumberWithHttpInfo + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deletePhoneNumberWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0]) + { + $request = $this->deletePhoneNumberRequest($phone_number_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deletePhoneNumberAsync + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePhoneNumberAsync($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0]) + { + return $this->deletePhoneNumberAsyncWithHttpInfo($phone_number_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePhoneNumberAsyncWithHttpInfo + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePhoneNumberAsyncWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0]) + { + $returnType = ''; + $request = $this->deletePhoneNumberRequest($phone_number_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deletePhoneNumber' + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePhoneNumberRequest($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0]) + { + + // verify the required parameter 'phone_number_id' is set + if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone_number_id when calling deletePhoneNumber' + ); + } + + + $resourcePath = '/phone/numbers/{phoneNumberId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone_number_id !== null) { + $resourcePath = str_replace( + '{' . 'phoneNumberId' . '}', + ObjectSerializer::toPathValue($phone_number_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmergencyAddress + * + * @param string $address_id address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmergencyAddress + */ + public function getEmergencyAddress($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0]) + { + list($response) = $this->getEmergencyAddressWithHttpInfo($address_id, $contentType); + return $response; + } + + /** + * Operation getEmergencyAddressWithHttpInfo + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmergencyAddress, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmergencyAddressWithHttpInfo($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0]) + { + $request = $this->getEmergencyAddressRequest($address_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmergencyAddress' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmergencyAddress' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddress', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmergencyAddress'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmergencyAddress', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmergencyAddressAsync + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmergencyAddressAsync($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0]) + { + return $this->getEmergencyAddressAsyncWithHttpInfo($address_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmergencyAddressAsyncWithHttpInfo + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmergencyAddressAsyncWithHttpInfo($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0]) + { + $returnType = '\MailSlurp\Models\EmergencyAddress'; + $request = $this->getEmergencyAddressRequest($address_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmergencyAddress' + * + * @param string $address_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmergencyAddressRequest($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0]) + { + + // verify the required parameter 'address_id' is set + if ($address_id === null || (is_array($address_id) && count($address_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $address_id when calling getEmergencyAddress' + ); + } + + + $resourcePath = '/phone/emergency-addresses/{addressId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($address_id !== null) { + $resourcePath = str_replace( + '{' . 'addressId' . '}', + ObjectSerializer::toPathValue($address_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEmergencyAddresses + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmergencyAddressDto[] + */ + public function getEmergencyAddresses(string $contentType = self::contentTypes['getEmergencyAddresses'][0]) + { + list($response) = $this->getEmergencyAddressesWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getEmergencyAddressesWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmergencyAddressDto[], HTTP status code, HTTP response headers (array of strings) + */ + public function getEmergencyAddressesWithHttpInfo(string $contentType = self::contentTypes['getEmergencyAddresses'][0]) + { + $request = $this->getEmergencyAddressesRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmergencyAddressDto[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmergencyAddressDto[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddressDto[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmergencyAddressDto[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmergencyAddressDto[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEmergencyAddressesAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmergencyAddressesAsync(string $contentType = self::contentTypes['getEmergencyAddresses'][0]) + { + return $this->getEmergencyAddressesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmergencyAddressesAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmergencyAddressesAsyncWithHttpInfo(string $contentType = self::contentTypes['getEmergencyAddresses'][0]) + { + $returnType = '\MailSlurp\Models\EmergencyAddressDto[]'; + $request = $this->getEmergencyAddressesRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEmergencyAddresses' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEmergencyAddressesRequest(string $contentType = self::contentTypes['getEmergencyAddresses'][0]) + { + + + $resourcePath = '/phone/emergency-addresses'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPhoneNumber + * + * @param string $phone_number_id phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PhoneNumberDto + */ + public function getPhoneNumber($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0]) + { + list($response) = $this->getPhoneNumberWithHttpInfo($phone_number_id, $contentType); + return $response; + } + + /** + * Operation getPhoneNumberWithHttpInfo + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PhoneNumberDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getPhoneNumberWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0]) + { + $request = $this->getPhoneNumberRequest($phone_number_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PhoneNumberDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PhoneNumberDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PhoneNumberDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PhoneNumberDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PhoneNumberDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPhoneNumberAsync + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumberAsync($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0]) + { + return $this->getPhoneNumberAsyncWithHttpInfo($phone_number_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPhoneNumberAsyncWithHttpInfo + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumberAsyncWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0]) + { + $returnType = '\MailSlurp\Models\PhoneNumberDto'; + $request = $this->getPhoneNumberRequest($phone_number_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPhoneNumber' + * + * @param string $phone_number_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPhoneNumberRequest($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0]) + { + + // verify the required parameter 'phone_number_id' is set + if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone_number_id when calling getPhoneNumber' + ); + } + + + $resourcePath = '/phone/numbers/{phoneNumberId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone_number_id !== null) { + $resourcePath = str_replace( + '{' . 'phoneNumberId' . '}', + ObjectSerializer::toPathValue($phone_number_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPhoneNumbers + * + * @param string $phone_country Optional phone country (optional) + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PagePhoneNumberProjection + */ + public function getPhoneNumbers($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0]) + { + list($response) = $this->getPhoneNumbersWithHttpInfo($phone_country, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getPhoneNumbersWithHttpInfo + * + * @param string $phone_country Optional phone country (optional) + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PagePhoneNumberProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getPhoneNumbersWithHttpInfo($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0]) + { + $request = $this->getPhoneNumbersRequest($phone_country, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PagePhoneNumberProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PagePhoneNumberProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PagePhoneNumberProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PagePhoneNumberProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PagePhoneNumberProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPhoneNumbersAsync + * + * @param string $phone_country Optional phone country (optional) + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumbersAsync($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0]) + { + return $this->getPhoneNumbersAsyncWithHttpInfo($phone_country, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPhoneNumbersAsyncWithHttpInfo + * + * @param string $phone_country Optional phone country (optional) + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumbersAsyncWithHttpInfo($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0]) + { + $returnType = '\MailSlurp\Models\PagePhoneNumberProjection'; + $request = $this->getPhoneNumbersRequest($phone_country, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPhoneNumbers' + * + * @param string $phone_country Optional phone country (optional) + * @param int $page Optional page index for list pagination (optional, default to 0) + * @param int $size Optional page size for list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPhoneNumbersRequest($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0]) + { + + + + + + + + + $resourcePath = '/phone/numbers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $phone_country, + 'phoneCountry', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPhonePlans + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PhonePlanDto[] + */ + public function getPhonePlans(string $contentType = self::contentTypes['getPhonePlans'][0]) + { + list($response) = $this->getPhonePlansWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getPhonePlansWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PhonePlanDto[], HTTP status code, HTTP response headers (array of strings) + */ + public function getPhonePlansWithHttpInfo(string $contentType = self::contentTypes['getPhonePlans'][0]) + { + $request = $this->getPhonePlansRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PhonePlanDto[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PhonePlanDto[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PhonePlanDto[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PhonePlanDto[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PhonePlanDto[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPhonePlansAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhonePlansAsync(string $contentType = self::contentTypes['getPhonePlans'][0]) + { + return $this->getPhonePlansAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPhonePlansAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhonePlansAsyncWithHttpInfo(string $contentType = self::contentTypes['getPhonePlans'][0]) + { + $returnType = '\MailSlurp\Models\PhonePlanDto[]'; + $request = $this->getPhonePlansRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPhonePlans' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPhonePlansRequest(string $contentType = self::contentTypes['getPhonePlans'][0]) + { + + + $resourcePath = '/phone/plans'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testPhoneNumberSendSms + * + * @param string $phone_number_id phone_number_id (required) + * @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options test_phone_number_options (required) + * @param string $x_test_id x_test_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function testPhoneNumberSendSms($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0]) + { + $this->testPhoneNumberSendSmsWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id, $contentType); + } + + /** + * Operation testPhoneNumberSendSmsWithHttpInfo + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required) + * @param string $x_test_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function testPhoneNumberSendSmsWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0]) + { + $request = $this->testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation testPhoneNumberSendSmsAsync + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required) + * @param string $x_test_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testPhoneNumberSendSmsAsync($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0]) + { + return $this->testPhoneNumberSendSmsAsyncWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testPhoneNumberSendSmsAsyncWithHttpInfo + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required) + * @param string $x_test_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testPhoneNumberSendSmsAsyncWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0]) + { + $returnType = ''; + $request = $this->testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testPhoneNumberSendSms' + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required) + * @param string $x_test_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0]) + { + + // verify the required parameter 'phone_number_id' is set + if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone_number_id when calling testPhoneNumberSendSms' + ); + } + + // verify the required parameter 'test_phone_number_options' is set + if ($test_phone_number_options === null || (is_array($test_phone_number_options) && count($test_phone_number_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $test_phone_number_options when calling testPhoneNumberSendSms' + ); + } + + + + $resourcePath = '/phone/numbers/{phoneNumberId}/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_test_id !== null) { + $headerParams['x-test-id'] = ObjectSerializer::toHeaderValue($x_test_id); + } + + // path params + if ($phone_number_id !== null) { + $resourcePath = str_replace( + '{' . 'phoneNumberId' . '}', + ObjectSerializer::toPathValue($phone_number_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($test_phone_number_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_phone_number_options)); + } else { + $httpBody = $test_phone_number_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/SentEmailsControllerApi.php b/lib/Apis/SentEmailsControllerApi.php new file mode 100644 index 00000000..0a709abc --- /dev/null +++ b/lib/Apis/SentEmailsControllerApi.php @@ -0,0 +1,5204 @@ + [ + 'application/json', + ], + 'deleteSentEmail' => [ + 'application/json', + ], + 'getAllSentTrackingPixels' => [ + 'application/json', + ], + 'getRawSentEmailContents' => [ + 'application/json', + ], + 'getRawSentEmailJson' => [ + 'application/json', + ], + 'getSentDeliveryStatus' => [ + 'application/json', + ], + 'getSentDeliveryStatuses' => [ + 'application/json', + ], + 'getSentDeliveryStatusesBySentId' => [ + 'application/json', + ], + 'getSentEmail' => [ + 'application/json', + ], + 'getSentEmailHTMLContent' => [ + 'application/json', + ], + 'getSentEmailPreviewURLs' => [ + 'application/json', + ], + 'getSentEmailTrackingPixels' => [ + 'application/json', + ], + 'getSentEmails' => [ + 'application/json', + ], + 'getSentEmailsWithQueueResults' => [ + 'application/json', + ], + 'getSentOrganizationEmails' => [ + 'application/json', + ], + 'waitForDeliveryStatuses' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation deleteAllSentEmails + * + * Delete all sent email receipts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllSentEmails(string $contentType = self::contentTypes['deleteAllSentEmails'][0]) + { + $this->deleteAllSentEmailsWithHttpInfo($contentType); + } + + /** + * Operation deleteAllSentEmailsWithHttpInfo + * + * Delete all sent email receipts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllSentEmailsWithHttpInfo(string $contentType = self::contentTypes['deleteAllSentEmails'][0]) + { + $request = $this->deleteAllSentEmailsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllSentEmailsAsync + * + * Delete all sent email receipts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllSentEmailsAsync(string $contentType = self::contentTypes['deleteAllSentEmails'][0]) + { + return $this->deleteAllSentEmailsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllSentEmailsAsyncWithHttpInfo + * + * Delete all sent email receipts + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllSentEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllSentEmails'][0]) + { + $returnType = ''; + $request = $this->deleteAllSentEmailsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllSentEmails' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllSentEmailsRequest(string $contentType = self::contentTypes['deleteAllSentEmails'][0]) + { + + + $resourcePath = '/sent'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSentEmail + * + * Delete sent email receipt + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSentEmail($id, string $contentType = self::contentTypes['deleteSentEmail'][0]) + { + $this->deleteSentEmailWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteSentEmailWithHttpInfo + * + * Delete sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSentEmailWithHttpInfo($id, string $contentType = self::contentTypes['deleteSentEmail'][0]) + { + $request = $this->deleteSentEmailRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteSentEmailAsync + * + * Delete sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSentEmailAsync($id, string $contentType = self::contentTypes['deleteSentEmail'][0]) + { + return $this->deleteSentEmailAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSentEmailAsyncWithHttpInfo + * + * Delete sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSentEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteSentEmail'][0]) + { + $returnType = ''; + $request = $this->deleteSentEmailRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSentEmail' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSentEmailRequest($id, string $contentType = self::contentTypes['deleteSentEmail'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteSentEmail' + ); + } + + + $resourcePath = '/sent/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllSentTrackingPixels + * + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageTrackingPixelProjection + */ + public function getAllSentTrackingPixels($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0]) + { + list($response) = $this->getAllSentTrackingPixelsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllSentTrackingPixelsWithHttpInfo + * + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllSentTrackingPixelsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0]) + { + $request = $this->getAllSentTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageTrackingPixelProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllSentTrackingPixelsAsync + * + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllSentTrackingPixelsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0]) + { + return $this->getAllSentTrackingPixelsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllSentTrackingPixelsAsyncWithHttpInfo + * + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllSentTrackingPixelsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0]) + { + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + $request = $this->getAllSentTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllSentTrackingPixels' + * + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllSentTrackingPixelsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0]) + { + + + + + + + + + $resourcePath = '/sent/tracking-pixels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRawSentEmailContents + * + * Get raw sent email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getRawSentEmailContents($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0]) + { + list($response) = $this->getRawSentEmailContentsWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getRawSentEmailContentsWithHttpInfo + * + * Get raw sent email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getRawSentEmailContentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0]) + { + $request = $this->getRawSentEmailContentsRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRawSentEmailContentsAsync + * + * Get raw sent email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawSentEmailContentsAsync($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0]) + { + return $this->getRawSentEmailContentsAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRawSentEmailContentsAsyncWithHttpInfo + * + * Get raw sent email string. Returns unparsed raw SMTP message with headers and body. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawSentEmailContentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0]) + { + $returnType = 'string'; + $request = $this->getRawSentEmailContentsRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRawSentEmailContents' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRawSentEmailContentsRequest($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRawSentEmailContents' + ); + } + + + $resourcePath = '/sent/{emailId}/raw'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRawSentEmailJson + * + * Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\RawEmailJson + */ + public function getRawSentEmailJson($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0]) + { + list($response) = $this->getRawSentEmailJsonWithHttpInfo($email_id, $contentType); + return $response; + } + + /** + * Operation getRawSentEmailJsonWithHttpInfo + * + * Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\RawEmailJson, HTTP status code, HTTP response headers (array of strings) + */ + public function getRawSentEmailJsonWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0]) + { + $request = $this->getRawSentEmailJsonRequest($email_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\RawEmailJson' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\RawEmailJson' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\RawEmailJson', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\RawEmailJson'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\RawEmailJson', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRawSentEmailJsonAsync + * + * Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawSentEmailJsonAsync($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0]) + { + return $this->getRawSentEmailJsonAsyncWithHttpInfo($email_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRawSentEmailJsonAsyncWithHttpInfo + * + * Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format. + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRawSentEmailJsonAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0]) + { + $returnType = '\MailSlurp\Models\RawEmailJson'; + $request = $this->getRawSentEmailJsonRequest($email_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRawSentEmailJson' + * + * @param string $email_id ID of email (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRawSentEmailJsonRequest($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0]) + { + + // verify the required parameter 'email_id' is set + if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email_id when calling getRawSentEmailJson' + ); + } + + + $resourcePath = '/sent/{emailId}/raw/json'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($email_id !== null) { + $resourcePath = str_replace( + '{' . 'emailId' . '}', + ObjectSerializer::toPathValue($email_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentDeliveryStatus + * + * @param string $delivery_id delivery_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DeliveryStatusDto + */ + public function getSentDeliveryStatus($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0]) + { + list($response) = $this->getSentDeliveryStatusWithHttpInfo($delivery_id, $contentType); + return $response; + } + + /** + * Operation getSentDeliveryStatusWithHttpInfo + * + * @param string $delivery_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DeliveryStatusDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentDeliveryStatusWithHttpInfo($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0]) + { + $request = $this->getSentDeliveryStatusRequest($delivery_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DeliveryStatusDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DeliveryStatusDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DeliveryStatusDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DeliveryStatusDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DeliveryStatusDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentDeliveryStatusAsync + * + * @param string $delivery_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusAsync($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0]) + { + return $this->getSentDeliveryStatusAsyncWithHttpInfo($delivery_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentDeliveryStatusAsyncWithHttpInfo + * + * @param string $delivery_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusAsyncWithHttpInfo($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0]) + { + $returnType = '\MailSlurp\Models\DeliveryStatusDto'; + $request = $this->getSentDeliveryStatusRequest($delivery_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentDeliveryStatus' + * + * @param string $delivery_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentDeliveryStatusRequest($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0]) + { + + // verify the required parameter 'delivery_id' is set + if ($delivery_id === null || (is_array($delivery_id) && count($delivery_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $delivery_id when calling getSentDeliveryStatus' + ); + } + + + $resourcePath = '/sent/delivery-status/{deliveryId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($delivery_id !== null) { + $resourcePath = str_replace( + '{' . 'deliveryId' . '}', + ObjectSerializer::toPathValue($delivery_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentDeliveryStatuses + * + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageDeliveryStatus + */ + public function getSentDeliveryStatuses($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0]) + { + list($response) = $this->getSentDeliveryStatusesWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentDeliveryStatusesWithHttpInfo + * + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentDeliveryStatusesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0]) + { + $request = $this->getSentDeliveryStatusesRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageDeliveryStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentDeliveryStatusesAsync + * + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0]) + { + return $this->getSentDeliveryStatusesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentDeliveryStatusesAsyncWithHttpInfo + * + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0]) + { + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + $request = $this->getSentDeliveryStatusesRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentDeliveryStatuses' + * + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentDeliveryStatusesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0]) + { + + + + + + + + $resourcePath = '/sent/delivery-status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentDeliveryStatusesBySentId + * + * @param string $sent_id sent_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageDeliveryStatus + */ + public function getSentDeliveryStatusesBySentId($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0]) + { + list($response) = $this->getSentDeliveryStatusesBySentIdWithHttpInfo($sent_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentDeliveryStatusesBySentIdWithHttpInfo + * + * @param string $sent_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentDeliveryStatusesBySentIdWithHttpInfo($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0]) + { + $request = $this->getSentDeliveryStatusesBySentIdRequest($sent_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageDeliveryStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentDeliveryStatusesBySentIdAsync + * + * @param string $sent_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusesBySentIdAsync($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0]) + { + return $this->getSentDeliveryStatusesBySentIdAsyncWithHttpInfo($sent_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentDeliveryStatusesBySentIdAsyncWithHttpInfo + * + * @param string $sent_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentDeliveryStatusesBySentIdAsyncWithHttpInfo($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0]) + { + $returnType = '\MailSlurp\Models\PageDeliveryStatus'; + $request = $this->getSentDeliveryStatusesBySentIdRequest($sent_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentDeliveryStatusesBySentId' + * + * @param string $sent_id (required) + * @param int $page Optional page index in delivery status list pagination (optional, default to 0) + * @param int $size Optional page size in delivery status list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentDeliveryStatusesBySentIdRequest($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0]) + { + + // verify the required parameter 'sent_id' is set + if ($sent_id === null || (is_array($sent_id) && count($sent_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sent_id when calling getSentDeliveryStatusesBySentId' + ); + } + + + + + + + + $resourcePath = '/sent/{sentId}/delivery-status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($sent_id !== null) { + $resourcePath = str_replace( + '{' . 'sentId' . '}', + ObjectSerializer::toPathValue($sent_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmail + * + * Get sent email receipt + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SentEmailDto + */ + public function getSentEmail($id, string $contentType = self::contentTypes['getSentEmail'][0]) + { + list($response) = $this->getSentEmailWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getSentEmailWithHttpInfo + * + * Get sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmail'][0]) + { + $request = $this->getSentEmailRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SentEmailDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SentEmailDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SentEmailDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailAsync + * + * Get sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailAsync($id, string $contentType = self::contentTypes['getSentEmail'][0]) + { + return $this->getSentEmailAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailAsyncWithHttpInfo + * + * Get sent email receipt + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmail'][0]) + { + $returnType = '\MailSlurp\Models\SentEmailDto'; + $request = $this->getSentEmailRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmail' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailRequest($id, string $contentType = self::contentTypes['getSentEmail'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getSentEmail' + ); + } + + + $resourcePath = '/sent/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmailHTMLContent + * + * Get sent email HTML content + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getSentEmailHTMLContent($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0]) + { + list($response) = $this->getSentEmailHTMLContentWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getSentEmailHTMLContentWithHttpInfo + * + * Get sent email HTML content + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailHTMLContentWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0]) + { + $request = $this->getSentEmailHTMLContentRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailHTMLContentAsync + * + * Get sent email HTML content + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailHTMLContentAsync($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0]) + { + return $this->getSentEmailHTMLContentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailHTMLContentAsyncWithHttpInfo + * + * Get sent email HTML content + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailHTMLContentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0]) + { + $returnType = 'string'; + $request = $this->getSentEmailHTMLContentRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmailHTMLContent' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailHTMLContentRequest($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getSentEmailHTMLContent' + ); + } + + + $resourcePath = '/sent/{id}/html'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/html', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmailPreviewURLs + * + * Get sent email URL for viewing in browser or downloading + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreviewUrls + */ + public function getSentEmailPreviewURLs($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0]) + { + list($response) = $this->getSentEmailPreviewURLsWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getSentEmailPreviewURLsWithHttpInfo + * + * Get sent email URL for viewing in browser or downloading + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreviewUrls, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailPreviewURLsWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0]) + { + $request = $this->getSentEmailPreviewURLsRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreviewUrls' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreviewUrls' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreviewUrls', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreviewUrls'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreviewUrls', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailPreviewURLsAsync + * + * Get sent email URL for viewing in browser or downloading + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailPreviewURLsAsync($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0]) + { + return $this->getSentEmailPreviewURLsAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailPreviewURLsAsyncWithHttpInfo + * + * Get sent email URL for viewing in browser or downloading + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailPreviewURLsAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreviewUrls'; + $request = $this->getSentEmailPreviewURLsRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmailPreviewURLs' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailPreviewURLsRequest($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getSentEmailPreviewURLs' + ); + } + + + $resourcePath = '/sent/{id}/urls'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmailTrackingPixels + * + * @param string $id id (required) + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageTrackingPixelProjection + */ + public function getSentEmailTrackingPixels($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0]) + { + list($response) = $this->getSentEmailTrackingPixelsWithHttpInfo($id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentEmailTrackingPixelsWithHttpInfo + * + * @param string $id (required) + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailTrackingPixelsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0]) + { + $request = $this->getSentEmailTrackingPixelsRequest($id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageTrackingPixelProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailTrackingPixelsAsync + * + * @param string $id (required) + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailTrackingPixelsAsync($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0]) + { + return $this->getSentEmailTrackingPixelsAsyncWithHttpInfo($id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailTrackingPixelsAsyncWithHttpInfo + * + * @param string $id (required) + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailTrackingPixelsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0]) + { + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + $request = $this->getSentEmailTrackingPixelsRequest($id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmailTrackingPixels' + * + * @param string $id (required) + * @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0) + * @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailTrackingPixelsRequest($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getSentEmailTrackingPixels' + ); + } + + + + + + + + + $resourcePath = '/sent/{id}/tracking-pixels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmails + * + * Get all sent emails in paginated form + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageSentEmailProjection + */ + public function getSentEmails($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0]) + { + list($response) = $this->getSentEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentEmailsWithHttpInfo + * + * Get all sent emails in paginated form + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0]) + { + $request = $this->getSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageSentEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailsAsync + * + * Get all sent emails in paginated form + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0]) + { + return $this->getSentEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailsAsyncWithHttpInfo + * + * Get all sent emails in paginated form + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + $request = $this->getSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmails' + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0]) + { + + + + + + + + + + $resourcePath = '/sent'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentEmailsWithQueueResults + * + * Get results of email sent with queues in paginated form + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageSentEmailWithQueueProjection + */ + public function getSentEmailsWithQueueResults($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0]) + { + list($response) = $this->getSentEmailsWithQueueResultsWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentEmailsWithQueueResultsWithHttpInfo + * + * Get results of email sent with queues in paginated form + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageSentEmailWithQueueProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentEmailsWithQueueResultsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0]) + { + $request = $this->getSentEmailsWithQueueResultsRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageSentEmailWithQueueProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageSentEmailWithQueueProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailWithQueueProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageSentEmailWithQueueProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageSentEmailWithQueueProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentEmailsWithQueueResultsAsync + * + * Get results of email sent with queues in paginated form + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailsWithQueueResultsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0]) + { + return $this->getSentEmailsWithQueueResultsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentEmailsWithQueueResultsAsyncWithHttpInfo + * + * Get results of email sent with queues in paginated form + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentEmailsWithQueueResultsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0]) + { + $returnType = '\MailSlurp\Models\PageSentEmailWithQueueProjection'; + $request = $this->getSentEmailsWithQueueResultsRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentEmailsWithQueueResults' + * + * @param int $page Optional page index in inbox sent email list pagination (optional, default to 0) + * @param int $size Optional page size in inbox sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentEmailsWithQueueResultsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0]) + { + + + + + + + + $resourcePath = '/sent/queue-results'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSentOrganizationEmails + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in sent email list pagination (optional, default to 0) + * @param int $size Optional page size in sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageSentEmailProjection + */ + public function getSentOrganizationEmails($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0]) + { + list($response) = $this->getSentOrganizationEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSentOrganizationEmailsWithHttpInfo + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in sent email list pagination (optional, default to 0) + * @param int $size Optional page size in sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getSentOrganizationEmailsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0]) + { + $request = $this->getSentOrganizationEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageSentEmailProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSentOrganizationEmailsAsync + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in sent email list pagination (optional, default to 0) + * @param int $size Optional page size in sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentOrganizationEmailsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0]) + { + return $this->getSentOrganizationEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSentOrganizationEmailsAsyncWithHttpInfo + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in sent email list pagination (optional, default to 0) + * @param int $size Optional page size in sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSentOrganizationEmailsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0]) + { + $returnType = '\MailSlurp\Models\PageSentEmailProjection'; + $request = $this->getSentOrganizationEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSentOrganizationEmails' + * + * @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional) + * @param int $page Optional page index in sent email list pagination (optional, default to 0) + * @param int $size Optional page size in sent email list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSentOrganizationEmailsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0]) + { + + + + + + + + + + $resourcePath = '/sent/organization'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForDeliveryStatuses + * + * @param string $sent_id Optional sent email ID filter (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\DeliveryStatusDto + */ + public function waitForDeliveryStatuses($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0]) + { + list($response) = $this->waitForDeliveryStatusesWithHttpInfo($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType); + return $response; + } + + /** + * Operation waitForDeliveryStatusesWithHttpInfo + * + * @param string $sent_id Optional sent email ID filter (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\DeliveryStatusDto, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForDeliveryStatusesWithHttpInfo($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0]) + { + $request = $this->waitForDeliveryStatusesRequest($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\DeliveryStatusDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\DeliveryStatusDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\DeliveryStatusDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\DeliveryStatusDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\DeliveryStatusDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForDeliveryStatusesAsync + * + * @param string $sent_id Optional sent email ID filter (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForDeliveryStatusesAsync($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0]) + { + return $this->waitForDeliveryStatusesAsyncWithHttpInfo($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForDeliveryStatusesAsyncWithHttpInfo + * + * @param string $sent_id Optional sent email ID filter (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForDeliveryStatusesAsyncWithHttpInfo($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0]) + { + $returnType = '\MailSlurp\Models\DeliveryStatusDto'; + $request = $this->waitForDeliveryStatusesRequest($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForDeliveryStatuses' + * + * @param string $sent_id Optional sent email ID filter (optional) + * @param string $inbox_id Optional inbox ID filter (optional) + * @param int $timeout Optional timeout milliseconds (optional) + * @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForDeliveryStatusesRequest($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0]) + { + + + + + if ($index !== null && $index > 2147483647) { + throw new \InvalidArgumentException('invalid value for "$index" when calling SentEmailsControllerApi.waitForDeliveryStatuses, must be smaller than or equal to 2147483647.'); + } + if ($index !== null && $index < 0) { + throw new \InvalidArgumentException('invalid value for "$index" when calling SentEmailsControllerApi.waitForDeliveryStatuses, must be bigger than or equal to 0.'); + } + + + + + $resourcePath = '/sent/delivery-status/wait-for'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sent_id, + 'sentId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $index, + 'index', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/SmsControllerApi.php b/lib/Apis/SmsControllerApi.php new file mode 100644 index 00000000..a5d28c5a --- /dev/null +++ b/lib/Apis/SmsControllerApi.php @@ -0,0 +1,1280 @@ + [ + 'application/json', + ], + 'deleteSmsMessages' => [ + 'application/json', + ], + 'getSmsMessage' => [ + 'application/json', + ], + 'getSmsMessagesPaginated' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation deleteSmsMessage + * + * Delete SMS message. + * + * @param string $sms_id sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSmsMessage($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0]) + { + $this->deleteSmsMessageWithHttpInfo($sms_id, $contentType); + } + + /** + * Operation deleteSmsMessageWithHttpInfo + * + * Delete SMS message. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSmsMessageWithHttpInfo($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0]) + { + $request = $this->deleteSmsMessageRequest($sms_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteSmsMessageAsync + * + * Delete SMS message. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmsMessageAsync($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0]) + { + return $this->deleteSmsMessageAsyncWithHttpInfo($sms_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSmsMessageAsyncWithHttpInfo + * + * Delete SMS message. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmsMessageAsyncWithHttpInfo($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0]) + { + $returnType = ''; + $request = $this->deleteSmsMessageRequest($sms_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSmsMessage' + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSmsMessageRequest($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0]) + { + + // verify the required parameter 'sms_id' is set + if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sms_id when calling deleteSmsMessage' + ); + } + + + $resourcePath = '/sms/{smsId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($sms_id !== null) { + $resourcePath = str_replace( + '{' . 'smsId' . '}', + ObjectSerializer::toPathValue($sms_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSmsMessages + * + * Delete all SMS messages + * + * @param string $phone_number_id phone_number_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSmsMessages($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0]) + { + $this->deleteSmsMessagesWithHttpInfo($phone_number_id, $contentType); + } + + /** + * Operation deleteSmsMessagesWithHttpInfo + * + * Delete all SMS messages + * + * @param string $phone_number_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSmsMessagesWithHttpInfo($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0]) + { + $request = $this->deleteSmsMessagesRequest($phone_number_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteSmsMessagesAsync + * + * Delete all SMS messages + * + * @param string $phone_number_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmsMessagesAsync($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0]) + { + return $this->deleteSmsMessagesAsyncWithHttpInfo($phone_number_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSmsMessagesAsyncWithHttpInfo + * + * Delete all SMS messages + * + * @param string $phone_number_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmsMessagesAsyncWithHttpInfo($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0]) + { + $returnType = ''; + $request = $this->deleteSmsMessagesRequest($phone_number_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSmsMessages' + * + * @param string $phone_number_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSmsMessagesRequest($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0]) + { + + + + $resourcePath = '/sms'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $phone_number_id, + 'phoneNumberId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSmsMessage + * + * Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. + * + * @param string $sms_id sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SmsDto + */ + public function getSmsMessage($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0]) + { + list($response) = $this->getSmsMessageWithHttpInfo($sms_id, $contentType); + return $response; + } + + /** + * Operation getSmsMessageWithHttpInfo + * + * Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SmsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getSmsMessageWithHttpInfo($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0]) + { + $request = $this->getSmsMessageRequest($sms_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SmsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SmsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SmsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SmsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSmsMessageAsync + * + * Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsMessageAsync($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0]) + { + return $this->getSmsMessageAsyncWithHttpInfo($sms_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmsMessageAsyncWithHttpInfo + * + * Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsMessageAsyncWithHttpInfo($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0]) + { + $returnType = '\MailSlurp\Models\SmsDto'; + $request = $this->getSmsMessageRequest($sms_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSmsMessage' + * + * @param string $sms_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSmsMessageRequest($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0]) + { + + // verify the required parameter 'sms_id' is set + if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sms_id when calling getSmsMessage' + ); + } + + + $resourcePath = '/sms/{smsId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($sms_id !== null) { + $resourcePath = str_replace( + '{' . 'smsId' . '}', + ObjectSerializer::toPathValue($sms_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSmsMessagesPaginated + * + * Get all SMS messages in all phone numbers in paginated form. . + * + * @param string $phone_number Optional receiving phone number to filter SMS messages for (optional) + * @param int $page Optional page index in SMS list pagination (optional, default to 0) + * @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param \DateTime $since Optional filter SMSs received after given date time (optional) + * @param \DateTime $before Optional filter SMSs received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageSmsProjection + */ + public function getSmsMessagesPaginated($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0]) + { + list($response) = $this->getSmsMessagesPaginatedWithHttpInfo($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType); + return $response; + } + + /** + * Operation getSmsMessagesPaginatedWithHttpInfo + * + * Get all SMS messages in all phone numbers in paginated form. . + * + * @param string $phone_number Optional receiving phone number to filter SMS messages for (optional) + * @param int $page Optional page index in SMS list pagination (optional, default to 0) + * @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param \DateTime $since Optional filter SMSs received after given date time (optional) + * @param \DateTime $before Optional filter SMSs received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageSmsProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getSmsMessagesPaginatedWithHttpInfo($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0]) + { + $request = $this->getSmsMessagesPaginatedRequest($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageSmsProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageSmsProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSmsProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageSmsProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageSmsProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSmsMessagesPaginatedAsync + * + * Get all SMS messages in all phone numbers in paginated form. . + * + * @param string $phone_number Optional receiving phone number to filter SMS messages for (optional) + * @param int $page Optional page index in SMS list pagination (optional, default to 0) + * @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param \DateTime $since Optional filter SMSs received after given date time (optional) + * @param \DateTime $before Optional filter SMSs received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsMessagesPaginatedAsync($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0]) + { + return $this->getSmsMessagesPaginatedAsyncWithHttpInfo($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmsMessagesPaginatedAsyncWithHttpInfo + * + * Get all SMS messages in all phone numbers in paginated form. . + * + * @param string $phone_number Optional receiving phone number to filter SMS messages for (optional) + * @param int $page Optional page index in SMS list pagination (optional, default to 0) + * @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param \DateTime $since Optional filter SMSs received after given date time (optional) + * @param \DateTime $before Optional filter SMSs received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsMessagesPaginatedAsyncWithHttpInfo($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageSmsProjection'; + $request = $this->getSmsMessagesPaginatedRequest($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSmsMessagesPaginated' + * + * @param string $phone_number Optional receiving phone number to filter SMS messages for (optional) + * @param int $page Optional page index in SMS list pagination (optional, default to 0) + * @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false) + * @param \DateTime $since Optional filter SMSs received after given date time (optional) + * @param \DateTime $before Optional filter SMSs received before given date time (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSmsMessagesPaginatedRequest($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0]) + { + + + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling SmsControllerApi.getSmsMessagesPaginated, must be smaller than or equal to 100.'); + } + + + + + + + $resourcePath = '/sms'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $phone_number, + 'phoneNumber', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/TemplateControllerApi.php b/lib/Apis/TemplateControllerApi.php new file mode 100644 index 00000000..321fe9f9 --- /dev/null +++ b/lib/Apis/TemplateControllerApi.php @@ -0,0 +1,2468 @@ + [ + 'application/json', + ], + 'deleteTemplate' => [ + 'application/json', + ], + 'getAllTemplates' => [ + 'application/json', + ], + 'getTemplate' => [ + 'application/json', + ], + 'getTemplatePreviewHtml' => [ + 'application/json', + ], + 'getTemplatePreviewJson' => [ + 'application/json', + ], + 'getTemplates' => [ + 'application/json', + ], + 'updateTemplate' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createTemplate + * + * Create a Template + * + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TemplateDto + */ + public function createTemplate($create_template_options, string $contentType = self::contentTypes['createTemplate'][0]) + { + list($response) = $this->createTemplateWithHttpInfo($create_template_options, $contentType); + return $response; + } + + /** + * Operation createTemplateWithHttpInfo + * + * Create a Template + * + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createTemplateWithHttpInfo($create_template_options, string $contentType = self::contentTypes['createTemplate'][0]) + { + $request = $this->createTemplateRequest($create_template_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TemplateDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TemplateDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TemplateDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createTemplateAsync + * + * Create a Template + * + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createTemplateAsync($create_template_options, string $contentType = self::contentTypes['createTemplate'][0]) + { + return $this->createTemplateAsyncWithHttpInfo($create_template_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createTemplateAsyncWithHttpInfo + * + * Create a Template + * + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createTemplateAsyncWithHttpInfo($create_template_options, string $contentType = self::contentTypes['createTemplate'][0]) + { + $returnType = '\MailSlurp\Models\TemplateDto'; + $request = $this->createTemplateRequest($create_template_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createTemplate' + * + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createTemplateRequest($create_template_options, string $contentType = self::contentTypes['createTemplate'][0]) + { + + // verify the required parameter 'create_template_options' is set + if ($create_template_options === null || (is_array($create_template_options) && count($create_template_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_template_options when calling createTemplate' + ); + } + + + $resourcePath = '/templates'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_template_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_options)); + } else { + $httpBody = $create_template_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteTemplate + * + * Delete email template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteTemplate($template_id, string $contentType = self::contentTypes['deleteTemplate'][0]) + { + $this->deleteTemplateWithHttpInfo($template_id, $contentType); + } + + /** + * Operation deleteTemplateWithHttpInfo + * + * Delete email template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteTemplateWithHttpInfo($template_id, string $contentType = self::contentTypes['deleteTemplate'][0]) + { + $request = $this->deleteTemplateRequest($template_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteTemplateAsync + * + * Delete email template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteTemplateAsync($template_id, string $contentType = self::contentTypes['deleteTemplate'][0]) + { + return $this->deleteTemplateAsyncWithHttpInfo($template_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteTemplateAsyncWithHttpInfo + * + * Delete email template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteTemplateAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['deleteTemplate'][0]) + { + $returnType = ''; + $request = $this->deleteTemplateRequest($template_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteTemplate' + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteTemplateRequest($template_id, string $contentType = self::contentTypes['deleteTemplate'][0]) + { + + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling deleteTemplate' + ); + } + + + $resourcePath = '/templates/{templateId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllTemplates + * + * List templates + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageTemplateProjection + */ + public function getAllTemplates($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0]) + { + list($response) = $this->getAllTemplatesWithHttpInfo($page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllTemplatesWithHttpInfo + * + * List templates + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageTemplateProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllTemplatesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0]) + { + $request = $this->getAllTemplatesRequest($page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageTemplateProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageTemplateProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTemplateProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageTemplateProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageTemplateProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllTemplatesAsync + * + * List templates + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTemplatesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0]) + { + return $this->getAllTemplatesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllTemplatesAsyncWithHttpInfo + * + * List templates + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTemplatesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0]) + { + $returnType = '\MailSlurp\Models\PageTemplateProjection'; + $request = $this->getAllTemplatesRequest($page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllTemplates' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllTemplatesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0]) + { + + + + + + + + $resourcePath = '/templates/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTemplate + * + * Get template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TemplateDto + */ + public function getTemplate($template_id, string $contentType = self::contentTypes['getTemplate'][0]) + { + list($response) = $this->getTemplateWithHttpInfo($template_id, $contentType); + return $response; + } + + /** + * Operation getTemplateWithHttpInfo + * + * Get template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getTemplateWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplate'][0]) + { + $request = $this->getTemplateRequest($template_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TemplateDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TemplateDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TemplateDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTemplateAsync + * + * Get template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplateAsync($template_id, string $contentType = self::contentTypes['getTemplate'][0]) + { + return $this->getTemplateAsyncWithHttpInfo($template_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTemplateAsyncWithHttpInfo + * + * Get template + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplateAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplate'][0]) + { + $returnType = '\MailSlurp\Models\TemplateDto'; + $request = $this->getTemplateRequest($template_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTemplate' + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTemplateRequest($template_id, string $contentType = self::contentTypes['getTemplate'][0]) + { + + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling getTemplate' + ); + } + + + $resourcePath = '/templates/{templateId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTemplatePreviewHtml + * + * Get template preview HTML + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function getTemplatePreviewHtml($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0]) + { + list($response) = $this->getTemplatePreviewHtmlWithHttpInfo($template_id, $contentType); + return $response; + } + + /** + * Operation getTemplatePreviewHtmlWithHttpInfo + * + * Get template preview HTML + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function getTemplatePreviewHtmlWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0]) + { + $request = $this->getTemplatePreviewHtmlRequest($template_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTemplatePreviewHtmlAsync + * + * Get template preview HTML + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatePreviewHtmlAsync($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0]) + { + return $this->getTemplatePreviewHtmlAsyncWithHttpInfo($template_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTemplatePreviewHtmlAsyncWithHttpInfo + * + * Get template preview HTML + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatePreviewHtmlAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0]) + { + $returnType = 'string'; + $request = $this->getTemplatePreviewHtmlRequest($template_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTemplatePreviewHtml' + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTemplatePreviewHtmlRequest($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0]) + { + + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling getTemplatePreviewHtml' + ); + } + + + $resourcePath = '/templates/{templateId}/preview/html'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/html;charset=utf-8', 'text/html', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTemplatePreviewJson + * + * Get template preview Json + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TemplatePreview + */ + public function getTemplatePreviewJson($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0]) + { + list($response) = $this->getTemplatePreviewJsonWithHttpInfo($template_id, $contentType); + return $response; + } + + /** + * Operation getTemplatePreviewJsonWithHttpInfo + * + * Get template preview Json + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TemplatePreview, HTTP status code, HTTP response headers (array of strings) + */ + public function getTemplatePreviewJsonWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0]) + { + $request = $this->getTemplatePreviewJsonRequest($template_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\TemplatePreview' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TemplatePreview' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplatePreview', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TemplatePreview'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TemplatePreview', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTemplatePreviewJsonAsync + * + * Get template preview Json + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatePreviewJsonAsync($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0]) + { + return $this->getTemplatePreviewJsonAsyncWithHttpInfo($template_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTemplatePreviewJsonAsyncWithHttpInfo + * + * Get template preview Json + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatePreviewJsonAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0]) + { + $returnType = '\MailSlurp\Models\TemplatePreview'; + $request = $this->getTemplatePreviewJsonRequest($template_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTemplatePreviewJson' + * + * @param string $template_id Template ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTemplatePreviewJsonRequest($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0]) + { + + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling getTemplatePreviewJson' + ); + } + + + $resourcePath = '/templates/{templateId}/preview/json'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTemplates + * + * List templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TemplateProjection[] + */ + public function getTemplates(string $contentType = self::contentTypes['getTemplates'][0]) + { + list($response) = $this->getTemplatesWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTemplatesWithHttpInfo + * + * List templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TemplateProjection[], HTTP status code, HTTP response headers (array of strings) + */ + public function getTemplatesWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + { + $request = $this->getTemplatesRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\TemplateProjection[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TemplateProjection[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateProjection[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TemplateProjection[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TemplateProjection[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTemplatesAsync + * + * List templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatesAsync(string $contentType = self::contentTypes['getTemplates'][0]) + { + return $this->getTemplatesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTemplatesAsyncWithHttpInfo + * + * List templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatesAsyncWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + { + $returnType = '\MailSlurp\Models\TemplateProjection[]'; + $request = $this->getTemplatesRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTemplates' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTemplatesRequest(string $contentType = self::contentTypes['getTemplates'][0]) + { + + + $resourcePath = '/templates'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateTemplate + * + * Update template + * + * @param string $template_id Template ID (required) + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TemplateDto + */ + public function updateTemplate($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0]) + { + list($response) = $this->updateTemplateWithHttpInfo($template_id, $create_template_options, $contentType); + return $response; + } + + /** + * Operation updateTemplateWithHttpInfo + * + * Update template + * + * @param string $template_id Template ID (required) + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateTemplateWithHttpInfo($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0]) + { + $request = $this->updateTemplateRequest($template_id, $create_template_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TemplateDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TemplateDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TemplateDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateTemplateAsync + * + * Update template + * + * @param string $template_id Template ID (required) + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateTemplateAsync($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0]) + { + return $this->updateTemplateAsyncWithHttpInfo($template_id, $create_template_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateTemplateAsyncWithHttpInfo + * + * Update template + * + * @param string $template_id Template ID (required) + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateTemplateAsyncWithHttpInfo($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0]) + { + $returnType = '\MailSlurp\Models\TemplateDto'; + $request = $this->updateTemplateRequest($template_id, $create_template_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateTemplate' + * + * @param string $template_id Template ID (required) + * @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateTemplateRequest($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0]) + { + + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling updateTemplate' + ); + } + + // verify the required parameter 'create_template_options' is set + if ($create_template_options === null || (is_array($create_template_options) && count($create_template_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_template_options when calling updateTemplate' + ); + } + + + $resourcePath = '/templates/{templateId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_template_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_options)); + } else { + $httpBody = $create_template_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/TrackingControllerApi.php b/lib/Apis/TrackingControllerApi.php new file mode 100644 index 00000000..ccd41470 --- /dev/null +++ b/lib/Apis/TrackingControllerApi.php @@ -0,0 +1,1083 @@ + [ + 'application/json', + ], + 'getAllTrackingPixels' => [ + 'application/json', + ], + 'getTrackingPixel' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createTrackingPixel + * + * Create tracking pixel + * + * @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options create_tracking_pixel_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TrackingPixelDto + */ + public function createTrackingPixel($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0]) + { + list($response) = $this->createTrackingPixelWithHttpInfo($create_tracking_pixel_options, $contentType); + return $response; + } + + /** + * Operation createTrackingPixelWithHttpInfo + * + * Create tracking pixel + * + * @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TrackingPixelDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createTrackingPixelWithHttpInfo($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0]) + { + $request = $this->createTrackingPixelRequest($create_tracking_pixel_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\TrackingPixelDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TrackingPixelDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TrackingPixelDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TrackingPixelDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TrackingPixelDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createTrackingPixelAsync + * + * Create tracking pixel + * + * @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createTrackingPixelAsync($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0]) + { + return $this->createTrackingPixelAsyncWithHttpInfo($create_tracking_pixel_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createTrackingPixelAsyncWithHttpInfo + * + * Create tracking pixel + * + * @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createTrackingPixelAsyncWithHttpInfo($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0]) + { + $returnType = '\MailSlurp\Models\TrackingPixelDto'; + $request = $this->createTrackingPixelRequest($create_tracking_pixel_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createTrackingPixel' + * + * @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createTrackingPixelRequest($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0]) + { + + // verify the required parameter 'create_tracking_pixel_options' is set + if ($create_tracking_pixel_options === null || (is_array($create_tracking_pixel_options) && count($create_tracking_pixel_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_tracking_pixel_options when calling createTrackingPixel' + ); + } + + + $resourcePath = '/tracking/pixels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_tracking_pixel_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_tracking_pixel_options)); + } else { + $httpBody = $create_tracking_pixel_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllTrackingPixels + * + * Get tracking pixels + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageTrackingPixelProjection + */ + public function getAllTrackingPixels($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0]) + { + list($response) = $this->getAllTrackingPixelsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllTrackingPixelsWithHttpInfo + * + * Get tracking pixels + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllTrackingPixelsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0]) + { + $request = $this->getAllTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageTrackingPixelProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllTrackingPixelsAsync + * + * Get tracking pixels + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTrackingPixelsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0]) + { + return $this->getAllTrackingPixelsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllTrackingPixelsAsyncWithHttpInfo + * + * Get tracking pixels + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTrackingPixelsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0]) + { + $returnType = '\MailSlurp\Models\PageTrackingPixelProjection'; + $request = $this->getAllTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllTrackingPixels' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllTrackingPixelsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0]) + { + + + + + + + + + $resourcePath = '/tracking/pixels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTrackingPixel + * + * Get pixel + * + * @param string $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\TrackingPixelDto + */ + public function getTrackingPixel($id, string $contentType = self::contentTypes['getTrackingPixel'][0]) + { + list($response) = $this->getTrackingPixelWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getTrackingPixelWithHttpInfo + * + * Get pixel + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\TrackingPixelDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getTrackingPixelWithHttpInfo($id, string $contentType = self::contentTypes['getTrackingPixel'][0]) + { + $request = $this->getTrackingPixelRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\TrackingPixelDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\TrackingPixelDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\TrackingPixelDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\TrackingPixelDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\TrackingPixelDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTrackingPixelAsync + * + * Get pixel + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTrackingPixelAsync($id, string $contentType = self::contentTypes['getTrackingPixel'][0]) + { + return $this->getTrackingPixelAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTrackingPixelAsyncWithHttpInfo + * + * Get pixel + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTrackingPixelAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getTrackingPixel'][0]) + { + $returnType = '\MailSlurp\Models\TrackingPixelDto'; + $request = $this->getTrackingPixelRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTrackingPixel' + * + * @param string $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTrackingPixelRequest($id, string $contentType = self::contentTypes['getTrackingPixel'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getTrackingPixel' + ); + } + + + $resourcePath = '/tracking/pixels/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/WaitForControllerApi.php b/lib/Apis/WaitForControllerApi.php new file mode 100644 index 00000000..0d40a645 --- /dev/null +++ b/lib/Apis/WaitForControllerApi.php @@ -0,0 +1,3016 @@ + [ + 'application/json', + ], + 'waitForEmailCount' => [ + 'application/json', + ], + 'waitForLatestEmail' => [ + 'application/json', + ], + 'waitForLatestSms' => [ + 'application/json', + ], + 'waitForMatchingEmails' => [ + 'application/json', + ], + 'waitForMatchingFirstEmail' => [ + 'application/json', + ], + 'waitForNthEmail' => [ + 'application/json', + ], + 'waitForSms' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation waitFor + * + * Wait for an email to match the provided filter conditions such as subject contains keyword. + * + * @param \MailSlurp\Models\WaitForConditions $wait_for_conditions wait_for_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview[] + */ + public function waitFor($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0]) + { + list($response) = $this->waitForWithHttpInfo($wait_for_conditions, $contentType); + return $response; + } + + /** + * Operation waitForWithHttpInfo + * + * Wait for an email to match the provided filter conditions such as subject contains keyword. + * + * @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function waitForWithHttpInfo($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0]) + { + $request = $this->waitForRequest($wait_for_conditions, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForAsync + * + * Wait for an email to match the provided filter conditions such as subject contains keyword. + * + * @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForAsync($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0]) + { + return $this->waitForAsyncWithHttpInfo($wait_for_conditions, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForAsyncWithHttpInfo + * + * Wait for an email to match the provided filter conditions such as subject contains keyword. + * + * @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForAsyncWithHttpInfo($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview[]'; + $request = $this->waitForRequest($wait_for_conditions, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitFor' + * + * @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForRequest($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0]) + { + + // verify the required parameter 'wait_for_conditions' is set + if ($wait_for_conditions === null || (is_array($wait_for_conditions) && count($wait_for_conditions) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $wait_for_conditions when calling waitFor' + ); + } + + + $resourcePath = '/waitFor'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($wait_for_conditions)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_conditions)); + } else { + $httpBody = $wait_for_conditions; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForEmailCount + * + * Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater that 1 (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview[] + */ + public function waitForEmailCount($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0]) + { + list($response) = $this->waitForEmailCountWithHttpInfo($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + return $response; + } + + /** + * Operation waitForEmailCountWithHttpInfo + * + * Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater that 1 (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function waitForEmailCountWithHttpInfo($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0]) + { + $request = $this->waitForEmailCountRequest($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForEmailCountAsync + * + * Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater that 1 (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForEmailCountAsync($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0]) + { + return $this->waitForEmailCountAsyncWithHttpInfo($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForEmailCountAsyncWithHttpInfo + * + * Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater that 1 (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForEmailCountAsyncWithHttpInfo($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview[]'; + $request = $this->waitForEmailCountRequest($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForEmailCount' + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater that 1 (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForEmailCountRequest($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling waitForEmailCount' + ); + } + + // verify the required parameter 'count' is set + if ($count === null || (is_array($count) && count($count) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $count when calling waitForEmailCount' + ); + } + if ($count < 1) { + throw new \InvalidArgumentException('invalid value for "$count" when calling WaitForControllerApi.waitForEmailCount, must be bigger than or equal to 1.'); + } + + + + + + + + + $resourcePath = '/waitForEmailCount'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $count, + 'count', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay, + 'delay', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForLatestEmail + * + * Fetch inbox's latest email or if empty wait for an email to arrive + * + * @param string $inbox_id Id of the inbox we are fetching emails from (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only. (optional, default to false) + * @param \DateTime $before Filter for emails that were before after the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function waitForLatestEmail($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0]) + { + list($response) = $this->waitForLatestEmailWithHttpInfo($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + return $response; + } + + /** + * Operation waitForLatestEmailWithHttpInfo + * + * Fetch inbox's latest email or if empty wait for an email to arrive + * + * @param string $inbox_id Id of the inbox we are fetching emails from (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only. (optional, default to false) + * @param \DateTime $before Filter for emails that were before after the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForLatestEmailWithHttpInfo($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0]) + { + $request = $this->waitForLatestEmailRequest($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForLatestEmailAsync + * + * Fetch inbox's latest email or if empty wait for an email to arrive + * + * @param string $inbox_id Id of the inbox we are fetching emails from (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only. (optional, default to false) + * @param \DateTime $before Filter for emails that were before after the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForLatestEmailAsync($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0]) + { + return $this->waitForLatestEmailAsyncWithHttpInfo($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForLatestEmailAsyncWithHttpInfo + * + * Fetch inbox's latest email or if empty wait for an email to arrive + * + * @param string $inbox_id Id of the inbox we are fetching emails from (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only. (optional, default to false) + * @param \DateTime $before Filter for emails that were before after the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForLatestEmailAsyncWithHttpInfo($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->waitForLatestEmailRequest($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForLatestEmail' + * + * @param string $inbox_id Id of the inbox we are fetching emails from (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only. (optional, default to false) + * @param \DateTime $before Filter for emails that were before after the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForLatestEmailRequest($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0]) + { + + + + + + + + + + $resourcePath = '/waitForLatestEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay, + 'delay', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForLatestSms + * + * Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options wait_for_single_sms_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SmsDto + */ + public function waitForLatestSms($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0]) + { + list($response) = $this->waitForLatestSmsWithHttpInfo($wait_for_single_sms_options, $contentType); + return $response; + } + + /** + * Operation waitForLatestSmsWithHttpInfo + * + * Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SmsDto, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForLatestSmsWithHttpInfo($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0]) + { + $request = $this->waitForLatestSmsRequest($wait_for_single_sms_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SmsDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SmsDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SmsDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SmsDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForLatestSmsAsync + * + * Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForLatestSmsAsync($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0]) + { + return $this->waitForLatestSmsAsyncWithHttpInfo($wait_for_single_sms_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForLatestSmsAsyncWithHttpInfo + * + * Wait for the latest SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForLatestSmsAsyncWithHttpInfo($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0]) + { + $returnType = '\MailSlurp\Models\SmsDto'; + $request = $this->waitForLatestSmsRequest($wait_for_single_sms_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForLatestSms' + * + * @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForLatestSmsRequest($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0]) + { + + // verify the required parameter 'wait_for_single_sms_options' is set + if ($wait_for_single_sms_options === null || (is_array($wait_for_single_sms_options) && count($wait_for_single_sms_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $wait_for_single_sms_options when calling waitForLatestSms' + ); + } + + + $resourcePath = '/waitForLatestSms'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($wait_for_single_sms_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_single_sms_options)); + } else { + $httpBody = $wait_for_single_sms_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForMatchingEmails + * + * Wait or return list of emails that match simple matching patterns + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater or equal to 1 (required) + * @param \MailSlurp\Models\MatchOptions $match_options match_options (required) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\EmailPreview[] + */ + public function waitForMatchingEmails($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0]) + { + list($response) = $this->waitForMatchingEmailsWithHttpInfo($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType); + return $response; + } + + /** + * Operation waitForMatchingEmailsWithHttpInfo + * + * Wait or return list of emails that match simple matching patterns + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater or equal to 1 (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function waitForMatchingEmailsWithHttpInfo($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0]) + { + $request = $this->waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\EmailPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\EmailPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\EmailPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForMatchingEmailsAsync + * + * Wait or return list of emails that match simple matching patterns + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater or equal to 1 (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForMatchingEmailsAsync($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0]) + { + return $this->waitForMatchingEmailsAsyncWithHttpInfo($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForMatchingEmailsAsyncWithHttpInfo + * + * Wait or return list of emails that match simple matching patterns + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater or equal to 1 (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForMatchingEmailsAsyncWithHttpInfo($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0]) + { + $returnType = '\MailSlurp\Models\EmailPreview[]'; + $request = $this->waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForMatchingEmails' + * + * @param string $inbox_id Id of the inbox we are fetching emails from (required) + * @param int $count Number of emails to wait for. Must be greater or equal to 1 (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling waitForMatchingEmails' + ); + } + + // verify the required parameter 'count' is set + if ($count === null || (is_array($count) && count($count) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $count when calling waitForMatchingEmails' + ); + } + if ($count < 1) { + throw new \InvalidArgumentException('invalid value for "$count" when calling WaitForControllerApi.waitForMatchingEmails, must be bigger than or equal to 1.'); + } + + // verify the required parameter 'match_options' is set + if ($match_options === null || (is_array($match_options) && count($match_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $match_options when calling waitForMatchingEmails' + ); + } + + + + + + + + + $resourcePath = '/waitForMatchingEmails'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $count, + 'count', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay, + 'delay', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($match_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($match_options)); + } else { + $httpBody = $match_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForMatchingFirstEmail + * + * Wait for or return the first email that matches provided MatchOptions array + * + * @param string $inbox_id Id of the inbox we are matching an email for (required) + * @param \MailSlurp\Models\MatchOptions $match_options match_options (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function waitForMatchingFirstEmail($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0]) + { + list($response) = $this->waitForMatchingFirstEmailWithHttpInfo($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + return $response; + } + + /** + * Operation waitForMatchingFirstEmailWithHttpInfo + * + * Wait for or return the first email that matches provided MatchOptions array + * + * @param string $inbox_id Id of the inbox we are matching an email for (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForMatchingFirstEmailWithHttpInfo($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0]) + { + $request = $this->waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForMatchingFirstEmailAsync + * + * Wait for or return the first email that matches provided MatchOptions array + * + * @param string $inbox_id Id of the inbox we are matching an email for (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForMatchingFirstEmailAsync($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0]) + { + return $this->waitForMatchingFirstEmailAsyncWithHttpInfo($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForMatchingFirstEmailAsyncWithHttpInfo + * + * Wait for or return the first email that matches provided MatchOptions array + * + * @param string $inbox_id Id of the inbox we are matching an email for (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForMatchingFirstEmailAsyncWithHttpInfo($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForMatchingFirstEmail' + * + * @param string $inbox_id Id of the inbox we are matching an email for (required) + * @param \MailSlurp\Models\MatchOptions $match_options (required) + * @param int $timeout Max milliseconds to wait (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling waitForMatchingFirstEmail' + ); + } + + // verify the required parameter 'match_options' is set + if ($match_options === null || (is_array($match_options) && count($match_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $match_options when calling waitForMatchingFirstEmail' + ); + } + + + + + + + + + $resourcePath = '/waitForMatchingFirstEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay, + 'delay', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($match_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($match_options)); + } else { + $httpBody = $match_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForNthEmail + * + * Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. + * + * @param string $inbox_id Id of the inbox you are fetching emails from (optional) + * @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0) + * @param int $timeout Max milliseconds to wait for the nth email if not already present (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\Email + */ + public function waitForNthEmail($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0]) + { + list($response) = $this->waitForNthEmailWithHttpInfo($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + return $response; + } + + /** + * Operation waitForNthEmailWithHttpInfo + * + * Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. + * + * @param string $inbox_id Id of the inbox you are fetching emails from (optional) + * @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0) + * @param int $timeout Max milliseconds to wait for the nth email if not already present (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings) + */ + public function waitForNthEmailWithHttpInfo($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0]) + { + $request = $this->waitForNthEmailRequest($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\Email' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\Email' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\Email'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\Email', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForNthEmailAsync + * + * Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. + * + * @param string $inbox_id Id of the inbox you are fetching emails from (optional) + * @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0) + * @param int $timeout Max milliseconds to wait for the nth email if not already present (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForNthEmailAsync($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0]) + { + return $this->waitForNthEmailAsyncWithHttpInfo($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForNthEmailAsyncWithHttpInfo + * + * Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur. + * + * @param string $inbox_id Id of the inbox you are fetching emails from (optional) + * @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0) + * @param int $timeout Max milliseconds to wait for the nth email if not already present (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForNthEmailAsyncWithHttpInfo($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0]) + { + $returnType = '\MailSlurp\Models\Email'; + $request = $this->waitForNthEmailRequest($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForNthEmail' + * + * @param string $inbox_id Id of the inbox you are fetching emails from (optional) + * @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0) + * @param int $timeout Max milliseconds to wait for the nth email if not already present (optional) + * @param bool $unread_only Optional filter for unread only (optional, default to false) + * @param \DateTime $since Filter for emails that were received after the given timestamp (optional) + * @param \DateTime $before Filter for emails that were received before the given timestamp (optional) + * @param string $sort Sort direction (optional) + * @param int $delay Max milliseconds delay between calls (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForNthEmailRequest($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0]) + { + + + if ($index !== null && $index > 2147483647) { + throw new \InvalidArgumentException('invalid value for "$index" when calling WaitForControllerApi.waitForNthEmail, must be smaller than or equal to 2147483647.'); + } + if ($index !== null && $index < 0) { + throw new \InvalidArgumentException('invalid value for "$index" when calling WaitForControllerApi.waitForNthEmail, must be bigger than or equal to 0.'); + } + + + + + + + + + $resourcePath = '/waitForNthEmail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $index, + 'index', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $timeout, + 'timeout', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unread_only, + 'unreadOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $delay, + 'delay', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation waitForSms + * + * Wait for an SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions wait_for_sms_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\SmsPreview[] + */ + public function waitForSms($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0]) + { + list($response) = $this->waitForSmsWithHttpInfo($wait_for_sms_conditions, $contentType); + return $response; + } + + /** + * Operation waitForSmsWithHttpInfo + * + * Wait for an SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\SmsPreview[], HTTP status code, HTTP response headers (array of strings) + */ + public function waitForSmsWithHttpInfo($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0]) + { + $request = $this->waitForSmsRequest($wait_for_sms_conditions, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\SmsPreview[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\SmsPreview[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsPreview[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\SmsPreview[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\SmsPreview[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation waitForSmsAsync + * + * Wait for an SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForSmsAsync($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0]) + { + return $this->waitForSmsAsyncWithHttpInfo($wait_for_sms_conditions, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation waitForSmsAsyncWithHttpInfo + * + * Wait for an SMS message to match the provided filter conditions such as body contains keyword. + * + * @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function waitForSmsAsyncWithHttpInfo($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0]) + { + $returnType = '\MailSlurp\Models\SmsPreview[]'; + $request = $this->waitForSmsRequest($wait_for_sms_conditions, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'waitForSms' + * + * @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function waitForSmsRequest($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0]) + { + + // verify the required parameter 'wait_for_sms_conditions' is set + if ($wait_for_sms_conditions === null || (is_array($wait_for_sms_conditions) && count($wait_for_sms_conditions) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $wait_for_sms_conditions when calling waitForSms' + ); + } + + + $resourcePath = '/waitForSms'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($wait_for_sms_conditions)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_sms_conditions)); + } else { + $httpBody = $wait_for_sms_conditions; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Apis/WebhookControllerApi.php b/lib/Apis/WebhookControllerApi.php new file mode 100644 index 00000000..11b11c8c --- /dev/null +++ b/lib/Apis/WebhookControllerApi.php @@ -0,0 +1,9938 @@ + [ + 'application/json', + ], + 'createWebhook' => [ + 'application/json', + ], + 'createWebhookForPhoneNumber' => [ + 'application/json', + ], + 'deleteAllWebhooks' => [ + 'application/json', + ], + 'deleteWebhook' => [ + 'application/json', + ], + 'deleteWebhookById' => [ + 'application/json', + ], + 'getAllAccountWebhooks' => [ + 'application/json', + ], + 'getAllWebhookResults' => [ + 'application/json', + ], + 'getAllWebhooks' => [ + 'application/json', + ], + 'getInboxWebhooksPaginated' => [ + 'application/json', + ], + 'getJsonSchemaForWebhookEvent' => [ + 'application/json', + ], + 'getJsonSchemaForWebhookPayload' => [ + 'application/json', + ], + 'getPhoneNumberWebhooksPaginated' => [ + 'application/json', + ], + 'getTestWebhookPayload' => [ + 'application/json', + ], + 'getTestWebhookPayloadBounce' => [ + 'application/json', + ], + 'getTestWebhookPayloadBounceRecipient' => [ + 'application/json', + ], + 'getTestWebhookPayloadDeliveryStatus' => [ + 'application/json', + ], + 'getTestWebhookPayloadEmailOpened' => [ + 'application/json', + ], + 'getTestWebhookPayloadEmailRead' => [ + 'application/json', + ], + 'getTestWebhookPayloadForWebhook' => [ + 'application/json', + ], + 'getTestWebhookPayloadNewAttachment' => [ + 'application/json', + ], + 'getTestWebhookPayloadNewContact' => [ + 'application/json', + ], + 'getTestWebhookPayloadNewEmail' => [ + 'application/json', + ], + 'getTestWebhookPayloadNewSms' => [ + 'application/json', + ], + 'getWebhook' => [ + 'application/json', + ], + 'getWebhookResult' => [ + 'application/json', + ], + 'getWebhookResults' => [ + 'application/json', + ], + 'getWebhookResultsUnseenErrorCount' => [ + 'application/json', + ], + 'getWebhooks' => [ + 'application/json', + ], + 'redriveWebhookResult' => [ + 'application/json', + ], + 'sendTestData' => [ + 'application/json', + ], + 'updateWebhookHeaders' => [ + 'application/json', + ], + 'verifyWebhookSignature' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createAccountWebhook + * + * Attach a WebHook URL to an inbox + * + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto + */ + public function createAccountWebhook($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0]) + { + list($response) = $this->createAccountWebhookWithHttpInfo($create_webhook_options, $contentType); + return $response; + } + + /** + * Operation createAccountWebhookWithHttpInfo + * + * Attach a WebHook URL to an inbox + * + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createAccountWebhookWithHttpInfo($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0]) + { + $request = $this->createAccountWebhookRequest($create_webhook_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAccountWebhookAsync + * + * Attach a WebHook URL to an inbox + * + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAccountWebhookAsync($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0]) + { + return $this->createAccountWebhookAsyncWithHttpInfo($create_webhook_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAccountWebhookAsyncWithHttpInfo + * + * Attach a WebHook URL to an inbox + * + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAccountWebhookAsyncWithHttpInfo($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto'; + $request = $this->createAccountWebhookRequest($create_webhook_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createAccountWebhook' + * + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createAccountWebhookRequest($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0]) + { + + // verify the required parameter 'create_webhook_options' is set + if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_webhook_options when calling createAccountWebhook' + ); + } + + + $resourcePath = '/webhooks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_webhook_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options)); + } else { + $httpBody = $create_webhook_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createWebhook + * + * Attach a WebHook URL to an inbox + * + * @param string $inbox_id inbox_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto + */ + public function createWebhook($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0]) + { + list($response) = $this->createWebhookWithHttpInfo($inbox_id, $create_webhook_options, $contentType); + return $response; + } + + /** + * Operation createWebhookWithHttpInfo + * + * Attach a WebHook URL to an inbox + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createWebhookWithHttpInfo($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0]) + { + $request = $this->createWebhookRequest($inbox_id, $create_webhook_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createWebhookAsync + * + * Attach a WebHook URL to an inbox + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookAsync($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0]) + { + return $this->createWebhookAsyncWithHttpInfo($inbox_id, $create_webhook_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createWebhookAsyncWithHttpInfo + * + * Attach a WebHook URL to an inbox + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookAsyncWithHttpInfo($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto'; + $request = $this->createWebhookRequest($inbox_id, $create_webhook_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createWebhook' + * + * @param string $inbox_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createWebhookRequest($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling createWebhook' + ); + } + + // verify the required parameter 'create_webhook_options' is set + if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_webhook_options when calling createWebhook' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/webhooks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_webhook_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options)); + } else { + $httpBody = $create_webhook_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createWebhookForPhoneNumber + * + * Attach a WebHook URL to a phone number + * + * @param string $phone_number_id phone_number_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto + */ + public function createWebhookForPhoneNumber($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0]) + { + list($response) = $this->createWebhookForPhoneNumberWithHttpInfo($phone_number_id, $create_webhook_options, $contentType); + return $response; + } + + /** + * Operation createWebhookForPhoneNumberWithHttpInfo + * + * Attach a WebHook URL to a phone number + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings) + */ + public function createWebhookForPhoneNumberWithHttpInfo($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0]) + { + $request = $this->createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createWebhookForPhoneNumberAsync + * + * Attach a WebHook URL to a phone number + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookForPhoneNumberAsync($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0]) + { + return $this->createWebhookForPhoneNumberAsyncWithHttpInfo($phone_number_id, $create_webhook_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createWebhookForPhoneNumberAsyncWithHttpInfo + * + * Attach a WebHook URL to a phone number + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookForPhoneNumberAsyncWithHttpInfo($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto'; + $request = $this->createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createWebhookForPhoneNumber' + * + * @param string $phone_number_id (required) + * @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0]) + { + + // verify the required parameter 'phone_number_id' is set + if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone_number_id when calling createWebhookForPhoneNumber' + ); + } + + // verify the required parameter 'create_webhook_options' is set + if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_webhook_options when calling createWebhookForPhoneNumber' + ); + } + + + $resourcePath = '/phone/numbers/{phoneNumberId}/webhooks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone_number_id !== null) { + $resourcePath = str_replace( + '{' . 'phoneNumberId' . '}', + ObjectSerializer::toPathValue($phone_number_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_webhook_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options)); + } else { + $httpBody = $create_webhook_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAllWebhooks + * + * Delete all webhooks + * + * @param \DateTime $before before (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAllWebhooks($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0]) + { + $this->deleteAllWebhooksWithHttpInfo($before, $contentType); + } + + /** + * Operation deleteAllWebhooksWithHttpInfo + * + * Delete all webhooks + * + * @param \DateTime $before before (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAllWebhooksWithHttpInfo($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0]) + { + $request = $this->deleteAllWebhooksRequest($before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAllWebhooksAsync + * + * Delete all webhooks + * + * @param \DateTime $before before (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllWebhooksAsync($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0]) + { + return $this->deleteAllWebhooksAsyncWithHttpInfo($before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAllWebhooksAsyncWithHttpInfo + * + * Delete all webhooks + * + * @param \DateTime $before before (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAllWebhooksAsyncWithHttpInfo($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0]) + { + $returnType = ''; + $request = $this->deleteAllWebhooksRequest($before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAllWebhooks' + * + * @param \DateTime $before before (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAllWebhooksRequest($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0]) + { + + + + $resourcePath = '/webhooks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteWebhook + * + * Delete and disable a Webhook for an Inbox + * + * @param string $inbox_id inbox_id (required) + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteWebhook($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0]) + { + $this->deleteWebhookWithHttpInfo($inbox_id, $webhook_id, $contentType); + } + + /** + * Operation deleteWebhookWithHttpInfo + * + * Delete and disable a Webhook for an Inbox + * + * @param string $inbox_id (required) + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteWebhookWithHttpInfo($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0]) + { + $request = $this->deleteWebhookRequest($inbox_id, $webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteWebhookAsync + * + * Delete and disable a Webhook for an Inbox + * + * @param string $inbox_id (required) + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteWebhookAsync($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0]) + { + return $this->deleteWebhookAsyncWithHttpInfo($inbox_id, $webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteWebhookAsyncWithHttpInfo + * + * Delete and disable a Webhook for an Inbox + * + * @param string $inbox_id (required) + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteWebhookAsyncWithHttpInfo($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0]) + { + $returnType = ''; + $request = $this->deleteWebhookRequest($inbox_id, $webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteWebhook' + * + * @param string $inbox_id (required) + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteWebhookRequest($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling deleteWebhook' + ); + } + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling deleteWebhook' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/webhooks/{webhookId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteWebhookById + * + * Delete a webhook + * + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteWebhookById($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0]) + { + $this->deleteWebhookByIdWithHttpInfo($webhook_id, $contentType); + } + + /** + * Operation deleteWebhookByIdWithHttpInfo + * + * Delete a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteWebhookByIdWithHttpInfo($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0]) + { + $request = $this->deleteWebhookByIdRequest($webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteWebhookByIdAsync + * + * Delete a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteWebhookByIdAsync($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0]) + { + return $this->deleteWebhookByIdAsyncWithHttpInfo($webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteWebhookByIdAsyncWithHttpInfo + * + * Delete a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteWebhookByIdAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0]) + { + $returnType = ''; + $request = $this->deleteWebhookByIdRequest($webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteWebhookById' + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteWebhookByIdRequest($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling deleteWebhookById' + ); + } + + + $resourcePath = '/webhooks/{webhookId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllAccountWebhooks + * + * List account webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $event_type Optional event type (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookProjection + */ + public function getAllAccountWebhooks($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0]) + { + list($response) = $this->getAllAccountWebhooksWithHttpInfo($page, $size, $sort, $event_type, $since, $before, $contentType); + return $response; + } + + /** + * Operation getAllAccountWebhooksWithHttpInfo + * + * List account webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $event_type Optional event type (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllAccountWebhooksWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0]) + { + $request = $this->getAllAccountWebhooksRequest($page, $size, $sort, $event_type, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllAccountWebhooksAsync + * + * List account webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $event_type Optional event type (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAccountWebhooksAsync($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0]) + { + return $this->getAllAccountWebhooksAsyncWithHttpInfo($page, $size, $sort, $event_type, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllAccountWebhooksAsyncWithHttpInfo + * + * List account webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $event_type Optional event type (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAccountWebhooksAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + $request = $this->getAllAccountWebhooksRequest($page, $size, $sort, $event_type, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllAccountWebhooks' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $event_type Optional event type (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllAccountWebhooksRequest($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0]) + { + + if ($page !== null && $page > 9223372036854775807) { + throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllAccountWebhooks, must be smaller than or equal to 9223372036854775807.'); + } + if ($page !== null && $page < 0) { + throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllAccountWebhooks, must be bigger than or equal to 0.'); + } + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllAccountWebhooks, must be smaller than or equal to 100.'); + } + if ($size !== null && $size < 1) { + throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllAccountWebhooks, must be bigger than or equal to 1.'); + } + + + + + + + $resourcePath = '/webhooks/account/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_type, + 'eventType', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllWebhookResults + * + * Get results for all webhooks + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookResult + */ + public function getAllWebhookResults($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getAllWebhookResults'][0]) + { + list($response) = $this->getAllWebhookResultsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + return $response; + } + + /** + * Operation getAllWebhookResultsWithHttpInfo + * + * Get results for all webhooks + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllWebhookResultsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getAllWebhookResults'][0]) + { + $request = $this->getAllWebhookResultsRequest($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllWebhookResultsAsync + * + * Get results for all webhooks + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllWebhookResultsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getAllWebhookResults'][0]) + { + return $this->getAllWebhookResultsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllWebhookResultsAsyncWithHttpInfo + * + * Get results for all webhooks + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllWebhookResultsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getAllWebhookResults'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookResult'; + $request = $this->getAllWebhookResultsRequest($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllWebhookResults' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllWebhookResultsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getAllWebhookResults'][0]) + { + + + + + + + + + + $resourcePath = '/webhooks/results'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unseen_only, + 'unseenOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllWebhooks + * + * List Webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param string $inbox_id Filter by inboxId (optional) + * @param string $phone_id Filter by phoneId (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookProjection + */ + public function getAllWebhooks($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0]) + { + list($response) = $this->getAllWebhooksWithHttpInfo($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType); + return $response; + } + + /** + * Operation getAllWebhooksWithHttpInfo + * + * List Webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param string $inbox_id Filter by inboxId (optional) + * @param string $phone_id Filter by phoneId (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllWebhooksWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0]) + { + $request = $this->getAllWebhooksRequest($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllWebhooksAsync + * + * List Webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param string $inbox_id Filter by inboxId (optional) + * @param string $phone_id Filter by phoneId (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllWebhooksAsync($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0]) + { + return $this->getAllWebhooksAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllWebhooksAsyncWithHttpInfo + * + * List Webhooks Paginated + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param string $inbox_id Filter by inboxId (optional) + * @param string $phone_id Filter by phoneId (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllWebhooksAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + $request = $this->getAllWebhooksRequest($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllWebhooks' + * + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size for paginated result list. (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param string $inbox_id Filter by inboxId (optional) + * @param string $phone_id Filter by phoneId (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllWebhooksRequest($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0]) + { + + if ($page !== null && $page > 9223372036854775807) { + throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllWebhooks, must be smaller than or equal to 9223372036854775807.'); + } + if ($page !== null && $page < 0) { + throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllWebhooks, must be bigger than or equal to 0.'); + } + + if ($size !== null && $size > 100) { + throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllWebhooks, must be smaller than or equal to 100.'); + } + if ($size !== null && $size < 1) { + throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllWebhooks, must be bigger than or equal to 1.'); + } + + + + + + + + + $resourcePath = '/webhooks/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $inbox_id, + 'inboxId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $phone_id, + 'phoneId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInboxWebhooksPaginated + * + * Get paginated webhooks for an Inbox + * + * @param string $inbox_id inbox_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookProjection + */ + public function getInboxWebhooksPaginated($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0]) + { + list($response) = $this->getInboxWebhooksPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + return $response; + } + + /** + * Operation getInboxWebhooksPaginatedWithHttpInfo + * + * Get paginated webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getInboxWebhooksPaginatedWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0]) + { + $request = $this->getInboxWebhooksPaginatedRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInboxWebhooksPaginatedAsync + * + * Get paginated webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxWebhooksPaginatedAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0]) + { + return $this->getInboxWebhooksPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInboxWebhooksPaginatedAsyncWithHttpInfo + * + * Get paginated webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInboxWebhooksPaginatedAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + $request = $this->getInboxWebhooksPaginatedRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInboxWebhooksPaginated' + * + * @param string $inbox_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInboxWebhooksPaginatedRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getInboxWebhooksPaginated' + ); + } + + + + + + + + + $resourcePath = '/inboxes/{inboxId}/webhooks/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getJsonSchemaForWebhookEvent + * + * @param string $event event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\JSONSchemaDto + */ + public function getJsonSchemaForWebhookEvent($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0]) + { + list($response) = $this->getJsonSchemaForWebhookEventWithHttpInfo($event, $contentType); + return $response; + } + + /** + * Operation getJsonSchemaForWebhookEventWithHttpInfo + * + * @param string $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\JSONSchemaDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getJsonSchemaForWebhookEventWithHttpInfo($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0]) + { + $request = $this->getJsonSchemaForWebhookEventRequest($event, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\JSONSchemaDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\JSONSchemaDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\JSONSchemaDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\JSONSchemaDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\JSONSchemaDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getJsonSchemaForWebhookEventAsync + * + * @param string $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonSchemaForWebhookEventAsync($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0]) + { + return $this->getJsonSchemaForWebhookEventAsyncWithHttpInfo($event, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getJsonSchemaForWebhookEventAsyncWithHttpInfo + * + * @param string $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonSchemaForWebhookEventAsyncWithHttpInfo($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0]) + { + $returnType = '\MailSlurp\Models\JSONSchemaDto'; + $request = $this->getJsonSchemaForWebhookEventRequest($event, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getJsonSchemaForWebhookEvent' + * + * @param string $event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getJsonSchemaForWebhookEventRequest($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0]) + { + + // verify the required parameter 'event' is set + if ($event === null || (is_array($event) && count($event) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event when calling getJsonSchemaForWebhookEvent' + ); + } + + + $resourcePath = '/webhooks/schema'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event, + 'event', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getJsonSchemaForWebhookPayload + * + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\JSONSchemaDto + */ + public function getJsonSchemaForWebhookPayload($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0]) + { + list($response) = $this->getJsonSchemaForWebhookPayloadWithHttpInfo($webhook_id, $contentType); + return $response; + } + + /** + * Operation getJsonSchemaForWebhookPayloadWithHttpInfo + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\JSONSchemaDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getJsonSchemaForWebhookPayloadWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0]) + { + $request = $this->getJsonSchemaForWebhookPayloadRequest($webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\JSONSchemaDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\JSONSchemaDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\JSONSchemaDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\JSONSchemaDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\JSONSchemaDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getJsonSchemaForWebhookPayloadAsync + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonSchemaForWebhookPayloadAsync($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0]) + { + return $this->getJsonSchemaForWebhookPayloadAsyncWithHttpInfo($webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getJsonSchemaForWebhookPayloadAsyncWithHttpInfo + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getJsonSchemaForWebhookPayloadAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0]) + { + $returnType = '\MailSlurp\Models\JSONSchemaDto'; + $request = $this->getJsonSchemaForWebhookPayloadRequest($webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getJsonSchemaForWebhookPayload' + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getJsonSchemaForWebhookPayloadRequest($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling getJsonSchemaForWebhookPayload' + ); + } + + + $resourcePath = '/webhooks/{webhookId}/schema'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPhoneNumberWebhooksPaginated + * + * Get paginated webhooks for a phone number + * + * @param string $phone_id phone_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookProjection + */ + public function getPhoneNumberWebhooksPaginated($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0]) + { + list($response) = $this->getPhoneNumberWebhooksPaginatedWithHttpInfo($phone_id, $page, $size, $sort, $since, $before, $contentType); + return $response; + } + + /** + * Operation getPhoneNumberWebhooksPaginatedWithHttpInfo + * + * Get paginated webhooks for a phone number + * + * @param string $phone_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings) + */ + public function getPhoneNumberWebhooksPaginatedWithHttpInfo($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0]) + { + $request = $this->getPhoneNumberWebhooksPaginatedRequest($phone_id, $page, $size, $sort, $since, $before, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookProjection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPhoneNumberWebhooksPaginatedAsync + * + * Get paginated webhooks for a phone number + * + * @param string $phone_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumberWebhooksPaginatedAsync($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0]) + { + return $this->getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo($phone_id, $page, $size, $sort, $since, $before, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo + * + * Get paginated webhooks for a phone number + * + * @param string $phone_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookProjection'; + $request = $this->getPhoneNumberWebhooksPaginatedRequest($phone_id, $page, $size, $sort, $since, $before, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPhoneNumberWebhooksPaginated' + * + * @param string $phone_id (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPhoneNumberWebhooksPaginatedRequest($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0]) + { + + // verify the required parameter 'phone_id' is set + if ($phone_id === null || (is_array($phone_id) && count($phone_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone_id when calling getPhoneNumberWebhooksPaginated' + ); + } + + + + + + + + $resourcePath = '/phone/numbers/{phoneId}/webhooks/paginated'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($phone_id !== null) { + $resourcePath = str_replace( + '{' . 'phoneId' . '}', + ObjectSerializer::toPathValue($phone_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayload + * + * @param string $event_name event_name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AbstractWebhookPayload + */ + public function getTestWebhookPayload($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0]) + { + list($response) = $this->getTestWebhookPayloadWithHttpInfo($event_name, $contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadWithHttpInfo + * + * @param string $event_name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AbstractWebhookPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadWithHttpInfo($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0]) + { + $request = $this->getTestWebhookPayloadRequest($event_name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\AbstractWebhookPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AbstractWebhookPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AbstractWebhookPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AbstractWebhookPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AbstractWebhookPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadAsync + * + * @param string $event_name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadAsync($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0]) + { + return $this->getTestWebhookPayloadAsyncWithHttpInfo($event_name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadAsyncWithHttpInfo + * + * @param string $event_name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadAsyncWithHttpInfo($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0]) + { + $returnType = '\MailSlurp\Models\AbstractWebhookPayload'; + $request = $this->getTestWebhookPayloadRequest($event_name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayload' + * + * @param string $event_name (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadRequest($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0]) + { + + + + $resourcePath = '/webhooks/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_name, + 'eventName', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadBounce + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookBouncePayload + */ + public function getTestWebhookPayloadBounce(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0]) + { + list($response) = $this->getTestWebhookPayloadBounceWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadBounceWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookBouncePayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadBounceWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0]) + { + $request = $this->getTestWebhookPayloadBounceRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookBouncePayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookBouncePayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookBouncePayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookBouncePayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookBouncePayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadBounceAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadBounceAsync(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0]) + { + return $this->getTestWebhookPayloadBounceAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadBounceAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadBounceAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0]) + { + $returnType = '\MailSlurp\Models\WebhookBouncePayload'; + $request = $this->getTestWebhookPayloadBounceRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadBounce' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadBounceRequest(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0]) + { + + + $resourcePath = '/webhooks/test/email-bounce-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadBounceRecipient + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookBounceRecipientPayload + */ + public function getTestWebhookPayloadBounceRecipient(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0]) + { + list($response) = $this->getTestWebhookPayloadBounceRecipientWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadBounceRecipientWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookBounceRecipientPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadBounceRecipientWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0]) + { + $request = $this->getTestWebhookPayloadBounceRecipientRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookBounceRecipientPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookBounceRecipientPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookBounceRecipientPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookBounceRecipientPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookBounceRecipientPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadBounceRecipientAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadBounceRecipientAsync(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0]) + { + return $this->getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0]) + { + $returnType = '\MailSlurp\Models\WebhookBounceRecipientPayload'; + $request = $this->getTestWebhookPayloadBounceRecipientRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadBounceRecipient' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadBounceRecipientRequest(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0]) + { + + + $resourcePath = '/webhooks/test/email-bounce-recipient-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadDeliveryStatus + * + * Get webhook test payload for delivery status event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDeliveryStatusPayload + */ + public function getTestWebhookPayloadDeliveryStatus(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0]) + { + list($response) = $this->getTestWebhookPayloadDeliveryStatusWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadDeliveryStatusWithHttpInfo + * + * Get webhook test payload for delivery status event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDeliveryStatusPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadDeliveryStatusWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0]) + { + $request = $this->getTestWebhookPayloadDeliveryStatusRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookDeliveryStatusPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDeliveryStatusPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDeliveryStatusPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDeliveryStatusPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDeliveryStatusPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadDeliveryStatusAsync + * + * Get webhook test payload for delivery status event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadDeliveryStatusAsync(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0]) + { + return $this->getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo + * + * Get webhook test payload for delivery status event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDeliveryStatusPayload'; + $request = $this->getTestWebhookPayloadDeliveryStatusRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadDeliveryStatus' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadDeliveryStatusRequest(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0]) + { + + + $resourcePath = '/webhooks/test/delivery-status-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadEmailOpened + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookEmailOpenedPayload + */ + public function getTestWebhookPayloadEmailOpened(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0]) + { + list($response) = $this->getTestWebhookPayloadEmailOpenedWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadEmailOpenedWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookEmailOpenedPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadEmailOpenedWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0]) + { + $request = $this->getTestWebhookPayloadEmailOpenedRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookEmailOpenedPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookEmailOpenedPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookEmailOpenedPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookEmailOpenedPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookEmailOpenedPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadEmailOpenedAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadEmailOpenedAsync(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0]) + { + return $this->getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0]) + { + $returnType = '\MailSlurp\Models\WebhookEmailOpenedPayload'; + $request = $this->getTestWebhookPayloadEmailOpenedRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadEmailOpened' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadEmailOpenedRequest(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0]) + { + + + $resourcePath = '/webhooks/test/email-opened-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadEmailRead + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookEmailReadPayload + */ + public function getTestWebhookPayloadEmailRead(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0]) + { + list($response) = $this->getTestWebhookPayloadEmailReadWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadEmailReadWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookEmailReadPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadEmailReadWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0]) + { + $request = $this->getTestWebhookPayloadEmailReadRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookEmailReadPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookEmailReadPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookEmailReadPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookEmailReadPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookEmailReadPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadEmailReadAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadEmailReadAsync(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0]) + { + return $this->getTestWebhookPayloadEmailReadAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadEmailReadAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadEmailReadAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0]) + { + $returnType = '\MailSlurp\Models\WebhookEmailReadPayload'; + $request = $this->getTestWebhookPayloadEmailReadRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadEmailRead' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadEmailReadRequest(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0]) + { + + + $resourcePath = '/webhooks/test/email-read-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadForWebhook + * + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\AbstractWebhookPayload + */ + public function getTestWebhookPayloadForWebhook($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0]) + { + list($response) = $this->getTestWebhookPayloadForWebhookWithHttpInfo($webhook_id, $contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadForWebhookWithHttpInfo + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\AbstractWebhookPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadForWebhookWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0]) + { + $request = $this->getTestWebhookPayloadForWebhookRequest($webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\AbstractWebhookPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\AbstractWebhookPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\AbstractWebhookPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\AbstractWebhookPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\AbstractWebhookPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadForWebhookAsync + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadForWebhookAsync($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0]) + { + return $this->getTestWebhookPayloadForWebhookAsyncWithHttpInfo($webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadForWebhookAsyncWithHttpInfo + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadForWebhookAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0]) + { + $returnType = '\MailSlurp\Models\AbstractWebhookPayload'; + $request = $this->getTestWebhookPayloadForWebhookRequest($webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadForWebhook' + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadForWebhookRequest($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling getTestWebhookPayloadForWebhook' + ); + } + + + $resourcePath = '/webhooks/{webhookId}/example'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadNewAttachment + * + * Get webhook test payload for new attachment event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookNewAttachmentPayload + */ + public function getTestWebhookPayloadNewAttachment(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0]) + { + list($response) = $this->getTestWebhookPayloadNewAttachmentWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadNewAttachmentWithHttpInfo + * + * Get webhook test payload for new attachment event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookNewAttachmentPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadNewAttachmentWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0]) + { + $request = $this->getTestWebhookPayloadNewAttachmentRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookNewAttachmentPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookNewAttachmentPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewAttachmentPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookNewAttachmentPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookNewAttachmentPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadNewAttachmentAsync + * + * Get webhook test payload for new attachment event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewAttachmentAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0]) + { + return $this->getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo + * + * Get webhook test payload for new attachment event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0]) + { + $returnType = '\MailSlurp\Models\WebhookNewAttachmentPayload'; + $request = $this->getTestWebhookPayloadNewAttachmentRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadNewAttachment' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadNewAttachmentRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0]) + { + + + $resourcePath = '/webhooks/test/new-attachment-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadNewContact + * + * Get webhook test payload for new contact event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookNewContactPayload + */ + public function getTestWebhookPayloadNewContact(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0]) + { + list($response) = $this->getTestWebhookPayloadNewContactWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadNewContactWithHttpInfo + * + * Get webhook test payload for new contact event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookNewContactPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadNewContactWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0]) + { + $request = $this->getTestWebhookPayloadNewContactRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookNewContactPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookNewContactPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewContactPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookNewContactPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookNewContactPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadNewContactAsync + * + * Get webhook test payload for new contact event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewContactAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0]) + { + return $this->getTestWebhookPayloadNewContactAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadNewContactAsyncWithHttpInfo + * + * Get webhook test payload for new contact event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewContactAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0]) + { + $returnType = '\MailSlurp\Models\WebhookNewContactPayload'; + $request = $this->getTestWebhookPayloadNewContactRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadNewContact' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadNewContactRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0]) + { + + + $resourcePath = '/webhooks/test/new-contact-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadNewEmail + * + * Get webhook test payload for new email event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookNewEmailPayload + */ + public function getTestWebhookPayloadNewEmail(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0]) + { + list($response) = $this->getTestWebhookPayloadNewEmailWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadNewEmailWithHttpInfo + * + * Get webhook test payload for new email event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookNewEmailPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadNewEmailWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0]) + { + $request = $this->getTestWebhookPayloadNewEmailRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookNewEmailPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookNewEmailPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewEmailPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookNewEmailPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookNewEmailPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadNewEmailAsync + * + * Get webhook test payload for new email event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewEmailAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0]) + { + return $this->getTestWebhookPayloadNewEmailAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadNewEmailAsyncWithHttpInfo + * + * Get webhook test payload for new email event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewEmailAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0]) + { + $returnType = '\MailSlurp\Models\WebhookNewEmailPayload'; + $request = $this->getTestWebhookPayloadNewEmailRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadNewEmail' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadNewEmailRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0]) + { + + + $resourcePath = '/webhooks/test/new-email-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTestWebhookPayloadNewSms + * + * Get webhook test payload for new sms event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookNewSmsPayload + */ + public function getTestWebhookPayloadNewSms(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0]) + { + list($response) = $this->getTestWebhookPayloadNewSmsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTestWebhookPayloadNewSmsWithHttpInfo + * + * Get webhook test payload for new sms event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookNewSmsPayload, HTTP status code, HTTP response headers (array of strings) + */ + public function getTestWebhookPayloadNewSmsWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0]) + { + $request = $this->getTestWebhookPayloadNewSmsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookNewSmsPayload' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookNewSmsPayload' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewSmsPayload', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookNewSmsPayload'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookNewSmsPayload', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTestWebhookPayloadNewSmsAsync + * + * Get webhook test payload for new sms event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewSmsAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0]) + { + return $this->getTestWebhookPayloadNewSmsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTestWebhookPayloadNewSmsAsyncWithHttpInfo + * + * Get webhook test payload for new sms event + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTestWebhookPayloadNewSmsAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0]) + { + $returnType = '\MailSlurp\Models\WebhookNewSmsPayload'; + $request = $this->getTestWebhookPayloadNewSmsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTestWebhookPayloadNewSms' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTestWebhookPayloadNewSmsRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0]) + { + + + $resourcePath = '/webhooks/test/new-sms-payload'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhook + * + * Get a webhook + * + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto + */ + public function getWebhook($webhook_id, string $contentType = self::contentTypes['getWebhook'][0]) + { + list($response) = $this->getWebhookWithHttpInfo($webhook_id, $contentType); + return $response; + } + + /** + * Operation getWebhookWithHttpInfo + * + * Get a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhookWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhook'][0]) + { + $request = $this->getWebhookRequest($webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getWebhookAsync + * + * Get a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookAsync($webhook_id, string $contentType = self::contentTypes['getWebhook'][0]) + { + return $this->getWebhookAsyncWithHttpInfo($webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getWebhookAsyncWithHttpInfo + * + * Get a webhook + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhook'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto'; + $request = $this->getWebhookRequest($webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getWebhook' + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getWebhookRequest($webhook_id, string $contentType = self::contentTypes['getWebhook'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling getWebhook' + ); + } + + + $resourcePath = '/webhooks/{webhookId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhookResult + * + * Get a webhook result for a webhook + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookResultDto + */ + public function getWebhookResult($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0]) + { + list($response) = $this->getWebhookResultWithHttpInfo($webhook_result_id, $contentType); + return $response; + } + + /** + * Operation getWebhookResultWithHttpInfo + * + * Get a webhook result for a webhook + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookResultDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhookResultWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0]) + { + $request = $this->getWebhookResultRequest($webhook_result_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookResultDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookResultDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookResultDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookResultDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookResultDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getWebhookResultAsync + * + * Get a webhook result for a webhook + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultAsync($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0]) + { + return $this->getWebhookResultAsyncWithHttpInfo($webhook_result_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getWebhookResultAsyncWithHttpInfo + * + * Get a webhook result for a webhook + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultAsyncWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0]) + { + $returnType = '\MailSlurp\Models\WebhookResultDto'; + $request = $this->getWebhookResultRequest($webhook_result_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getWebhookResult' + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getWebhookResultRequest($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0]) + { + + // verify the required parameter 'webhook_result_id' is set + if ($webhook_result_id === null || (is_array($webhook_result_id) && count($webhook_result_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_result_id when calling getWebhookResult' + ); + } + + + $resourcePath = '/webhooks/results/{webhookResultId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_result_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookResultId' . '}', + ObjectSerializer::toPathValue($webhook_result_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhookResults + * + * Get a webhook results for a webhook + * + * @param string $webhook_id ID of webhook to get results for (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\PageWebhookResult + */ + public function getWebhookResults($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getWebhookResults'][0]) + { + list($response) = $this->getWebhookResultsWithHttpInfo($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + return $response; + } + + /** + * Operation getWebhookResultsWithHttpInfo + * + * Get a webhook results for a webhook + * + * @param string $webhook_id ID of webhook to get results for (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\PageWebhookResult, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhookResultsWithHttpInfo($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getWebhookResults'][0]) + { + $request = $this->getWebhookResultsRequest($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\PageWebhookResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\PageWebhookResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\PageWebhookResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\PageWebhookResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getWebhookResultsAsync + * + * Get a webhook results for a webhook + * + * @param string $webhook_id ID of webhook to get results for (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultsAsync($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getWebhookResults'][0]) + { + return $this->getWebhookResultsAsyncWithHttpInfo($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getWebhookResultsAsyncWithHttpInfo + * + * Get a webhook results for a webhook + * + * @param string $webhook_id ID of webhook to get results for (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultsAsyncWithHttpInfo($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getWebhookResults'][0]) + { + $returnType = '\MailSlurp\Models\PageWebhookResult'; + $request = $this->getWebhookResultsRequest($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getWebhookResults' + * + * @param string $webhook_id ID of webhook to get results for (required) + * @param int $page Optional page index in list pagination (optional, default to 0) + * @param int $size Optional page size in list pagination (optional, default to 20) + * @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC') + * @param string $search_filter Optional search filter (optional) + * @param \DateTime $since Filter by created at after the given timestamp (optional) + * @param \DateTime $before Filter by created at before the given timestamp (optional) + * @param bool $unseen_only Filter for unseen exceptions only (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getWebhookResultsRequest($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, string $contentType = self::contentTypes['getWebhookResults'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling getWebhookResults' + ); + } + + + + + + + + + + $resourcePath = '/webhooks/{webhookId}/results'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_filter, + 'searchFilter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $since, + 'since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unseen_only, + 'unseenOnly', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhookResultsUnseenErrorCount + * + * Get count of unseen webhook results with error status + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\UnseenErrorCountDto + */ + public function getWebhookResultsUnseenErrorCount(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0]) + { + list($response) = $this->getWebhookResultsUnseenErrorCountWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getWebhookResultsUnseenErrorCountWithHttpInfo + * + * Get count of unseen webhook results with error status + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\UnseenErrorCountDto, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhookResultsUnseenErrorCountWithHttpInfo(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0]) + { + $request = $this->getWebhookResultsUnseenErrorCountRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\UnseenErrorCountDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\UnseenErrorCountDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\UnseenErrorCountDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\UnseenErrorCountDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\UnseenErrorCountDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getWebhookResultsUnseenErrorCountAsync + * + * Get count of unseen webhook results with error status + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultsUnseenErrorCountAsync(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0]) + { + return $this->getWebhookResultsUnseenErrorCountAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getWebhookResultsUnseenErrorCountAsyncWithHttpInfo + * + * Get count of unseen webhook results with error status + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getWebhookResultsUnseenErrorCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0]) + { + $returnType = '\MailSlurp\Models\UnseenErrorCountDto'; + $request = $this->getWebhookResultsUnseenErrorCountRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getWebhookResultsUnseenErrorCount' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getWebhookResultsUnseenErrorCountRequest(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0]) + { + + + $resourcePath = '/webhooks/results/unseen-count'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhooks + * + * Get all webhooks for an Inbox + * + * @param string $inbox_id inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto[] + * @deprecated + */ + public function getWebhooks($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0]) + { + list($response) = $this->getWebhooksWithHttpInfo($inbox_id, $contentType); + return $response; + } + + /** + * Operation getWebhooksWithHttpInfo + * + * Get all webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto[], HTTP status code, HTTP response headers (array of strings) + * @deprecated + */ + public function getWebhooksWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0]) + { + $request = $this->getWebhooksRequest($inbox_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookDto[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getWebhooksAsync + * + * Get all webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function getWebhooksAsync($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0]) + { + return $this->getWebhooksAsyncWithHttpInfo($inbox_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getWebhooksAsyncWithHttpInfo + * + * Get all webhooks for an Inbox + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function getWebhooksAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto[]'; + $request = $this->getWebhooksRequest($inbox_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getWebhooks' + * + * @param string $inbox_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function getWebhooksRequest($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0]) + { + + // verify the required parameter 'inbox_id' is set + if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $inbox_id when calling getWebhooks' + ); + } + + + $resourcePath = '/inboxes/{inboxId}/webhooks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($inbox_id !== null) { + $resourcePath = str_replace( + '{' . 'inboxId' . '}', + ObjectSerializer::toPathValue($inbox_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation redriveWebhookResult + * + * Get a webhook result and try to resend the original webhook payload + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookRedriveResult + */ + public function redriveWebhookResult($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0]) + { + list($response) = $this->redriveWebhookResultWithHttpInfo($webhook_result_id, $contentType); + return $response; + } + + /** + * Operation redriveWebhookResultWithHttpInfo + * + * Get a webhook result and try to resend the original webhook payload + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookRedriveResult, HTTP status code, HTTP response headers (array of strings) + */ + public function redriveWebhookResultWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0]) + { + $request = $this->redriveWebhookResultRequest($webhook_result_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookRedriveResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookRedriveResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookRedriveResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookRedriveResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookRedriveResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redriveWebhookResultAsync + * + * Get a webhook result and try to resend the original webhook payload + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redriveWebhookResultAsync($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0]) + { + return $this->redriveWebhookResultAsyncWithHttpInfo($webhook_result_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redriveWebhookResultAsyncWithHttpInfo + * + * Get a webhook result and try to resend the original webhook payload + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redriveWebhookResultAsyncWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0]) + { + $returnType = '\MailSlurp\Models\WebhookRedriveResult'; + $request = $this->redriveWebhookResultRequest($webhook_result_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'redriveWebhookResult' + * + * @param string $webhook_result_id Webhook Result ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redriveWebhookResultRequest($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0]) + { + + // verify the required parameter 'webhook_result_id' is set + if ($webhook_result_id === null || (is_array($webhook_result_id) && count($webhook_result_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_result_id when calling redriveWebhookResult' + ); + } + + + $resourcePath = '/webhooks/results/{webhookResultId}/redrive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_result_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookResultId' . '}', + ObjectSerializer::toPathValue($webhook_result_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendTestData + * + * Send webhook test data + * + * @param string $webhook_id webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookTestResult + */ + public function sendTestData($webhook_id, string $contentType = self::contentTypes['sendTestData'][0]) + { + list($response) = $this->sendTestDataWithHttpInfo($webhook_id, $contentType); + return $response; + } + + /** + * Operation sendTestDataWithHttpInfo + * + * Send webhook test data + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookTestResult, HTTP status code, HTTP response headers (array of strings) + */ + public function sendTestDataWithHttpInfo($webhook_id, string $contentType = self::contentTypes['sendTestData'][0]) + { + $request = $this->sendTestDataRequest($webhook_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\MailSlurp\Models\WebhookTestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookTestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookTestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookTestResult'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookTestResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendTestDataAsync + * + * Send webhook test data + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTestDataAsync($webhook_id, string $contentType = self::contentTypes['sendTestData'][0]) + { + return $this->sendTestDataAsyncWithHttpInfo($webhook_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendTestDataAsyncWithHttpInfo + * + * Send webhook test data + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTestDataAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['sendTestData'][0]) + { + $returnType = '\MailSlurp\Models\WebhookTestResult'; + $request = $this->sendTestDataRequest($webhook_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendTestData' + * + * @param string $webhook_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendTestDataRequest($webhook_id, string $contentType = self::contentTypes['sendTestData'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling sendTestData' + ); + } + + + $resourcePath = '/webhooks/{webhookId}/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateWebhookHeaders + * + * Update a webhook request headers + * + * @param string $webhook_id webhook_id (required) + * @param \MailSlurp\Models\WebhookHeaders $webhook_headers webhook_headers (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\WebhookDto + */ + public function updateWebhookHeaders($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0]) + { + list($response) = $this->updateWebhookHeadersWithHttpInfo($webhook_id, $webhook_headers, $contentType); + return $response; + } + + /** + * Operation updateWebhookHeadersWithHttpInfo + * + * Update a webhook request headers + * + * @param string $webhook_id (required) + * @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWebhookHeadersWithHttpInfo($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0]) + { + $request = $this->updateWebhookHeadersRequest($webhook_id, $webhook_headers, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\WebhookDto' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\WebhookDto'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\WebhookDto', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateWebhookHeadersAsync + * + * Update a webhook request headers + * + * @param string $webhook_id (required) + * @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateWebhookHeadersAsync($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0]) + { + return $this->updateWebhookHeadersAsyncWithHttpInfo($webhook_id, $webhook_headers, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateWebhookHeadersAsyncWithHttpInfo + * + * Update a webhook request headers + * + * @param string $webhook_id (required) + * @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateWebhookHeadersAsyncWithHttpInfo($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0]) + { + $returnType = '\MailSlurp\Models\WebhookDto'; + $request = $this->updateWebhookHeadersRequest($webhook_id, $webhook_headers, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateWebhookHeaders' + * + * @param string $webhook_id (required) + * @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateWebhookHeadersRequest($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0]) + { + + // verify the required parameter 'webhook_id' is set + if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_id when calling updateWebhookHeaders' + ); + } + + // verify the required parameter 'webhook_headers' is set + if ($webhook_headers === null || (is_array($webhook_headers) && count($webhook_headers) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $webhook_headers when calling updateWebhookHeaders' + ); + } + + + $resourcePath = '/webhooks/{webhookId}/headers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($webhook_id !== null) { + $resourcePath = str_replace( + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhook_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($webhook_headers)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($webhook_headers)); + } else { + $httpBody = $webhook_headers; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation verifyWebhookSignature + * + * Verify a webhook payload signature + * + * @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options verify_webhook_signature_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \MailSlurp\Models\VerifyWebhookSignatureResults + */ + public function verifyWebhookSignature($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0]) + { + list($response) = $this->verifyWebhookSignatureWithHttpInfo($verify_webhook_signature_options, $contentType); + return $response; + } + + /** + * Operation verifyWebhookSignatureWithHttpInfo + * + * Verify a webhook payload signature + * + * @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation + * + * @throws \MailSlurp\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \MailSlurp\Models\VerifyWebhookSignatureResults, HTTP status code, HTTP response headers (array of strings) + */ + public function verifyWebhookSignatureWithHttpInfo($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0]) + { + $request = $this->verifyWebhookSignatureRequest($verify_webhook_signature_options, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\MailSlurp\Models\VerifyWebhookSignatureResults' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\MailSlurp\Models\VerifyWebhookSignatureResults' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\MailSlurp\Models\VerifyWebhookSignatureResults', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\MailSlurp\Models\VerifyWebhookSignatureResults'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\MailSlurp\Models\VerifyWebhookSignatureResults', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation verifyWebhookSignatureAsync + * + * Verify a webhook payload signature + * + * @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function verifyWebhookSignatureAsync($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0]) + { + return $this->verifyWebhookSignatureAsyncWithHttpInfo($verify_webhook_signature_options, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation verifyWebhookSignatureAsyncWithHttpInfo + * + * Verify a webhook payload signature + * + * @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function verifyWebhookSignatureAsyncWithHttpInfo($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0]) + { + $returnType = '\MailSlurp\Models\VerifyWebhookSignatureResults'; + $request = $this->verifyWebhookSignatureRequest($verify_webhook_signature_options, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'verifyWebhookSignature' + * + * @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function verifyWebhookSignatureRequest($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0]) + { + + // verify the required parameter 'verify_webhook_signature_options' is set + if ($verify_webhook_signature_options === null || (is_array($verify_webhook_signature_options) && count($verify_webhook_signature_options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $verify_webhook_signature_options when calling verifyWebhookSignature' + ); + } + + + $resourcePath = '/webhooks/verify'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($verify_webhook_signature_options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($verify_webhook_signature_options)); + } else { + $httpBody = $verify_webhook_signature_options; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 00000000..2e634652 --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,533 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormatForQueryString Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (MailSlurp) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 6.5.2' . PHP_EOL; + $report .= ' SDK Package Version: 15.16.5' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://php.api.mailslurp.com", + "description" => "MailSlurp API Server", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); + } + + $host = $hostsSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 00000000..4f31c15e --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,246 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/lib/Models/AbstractWebhookPayload.php b/lib/Models/AbstractWebhookPayload.php new file mode 100644 index 00000000..654e9a53 --- /dev/null +++ b/lib/Models/AbstractWebhookPayload.php @@ -0,0 +1,580 @@ + + */ +class AbstractWebhookPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AbstractWebhookPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_name' => 'string', + 'message_id' => 'string', + 'webhook_id' => 'string', + 'webhook_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_name' => null, + 'message_id' => null, + 'webhook_id' => 'uuid', + 'webhook_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_name' => false, + 'message_id' => false, + 'webhook_id' => false, + 'webhook_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_name' => 'eventName', + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'webhook_name' => 'webhookName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_name' => 'setEventName', + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'webhook_name' => 'setWebhookName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_name' => 'getEventName', + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'webhook_name' => 'getWebhookName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id message_id + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id webhook_id + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name webhook_name + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + throw new \InvalidArgumentException('non-nullable webhook_name cannot be null'); + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/AliasDto.php b/lib/Models/AliasDto.php new file mode 100644 index 00000000..19f07351 --- /dev/null +++ b/lib/Models/AliasDto.php @@ -0,0 +1,787 @@ + + */ +class AliasDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AliasDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'email_address' => 'string', + 'masked_email_address' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'name' => 'string', + 'use_threads' => 'bool', + 'is_verified' => 'bool', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'email_address' => null, + 'masked_email_address' => null, + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'name' => null, + 'use_threads' => null, + 'is_verified' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email_address' => false, + 'masked_email_address' => true, + 'user_id' => false, + 'inbox_id' => false, + 'name' => true, + 'use_threads' => true, + 'is_verified' => false, + 'created_at' => true, + 'updated_at' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'email_address' => 'emailAddress', + 'masked_email_address' => 'maskedEmailAddress', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'name' => 'name', + 'use_threads' => 'useThreads', + 'is_verified' => 'isVerified', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'email_address' => 'setEmailAddress', + 'masked_email_address' => 'setMaskedEmailAddress', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'name' => 'setName', + 'use_threads' => 'setUseThreads', + 'is_verified' => 'setIsVerified', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'email_address' => 'getEmailAddress', + 'masked_email_address' => 'getMaskedEmailAddress', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'name' => 'getName', + 'use_threads' => 'getUseThreads', + 'is_verified' => 'getIsVerified', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('masked_email_address', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('use_threads', $data ?? [], null); + $this->setIfExists('is_verified', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['is_verified'] === null) { + $invalidProperties[] = "'is_verified' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address The alias's email address for receiving email + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets masked_email_address + * + * @return string|null + */ + public function getMaskedEmailAddress() + { + return $this->container['masked_email_address']; + } + + /** + * Sets masked_email_address + * + * @param string|null $masked_email_address The underlying email address that is hidden and will received forwarded email + * + * @return self + */ + public function setMaskedEmailAddress($masked_email_address) + { + + if (is_null($masked_email_address)) { + array_push($this->openAPINullablesSetToNull, 'masked_email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('masked_email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['masked_email_address'] = $masked_email_address; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Inbox that is associated with the alias + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets use_threads + * + * @return bool|null + */ + public function getUseThreads() + { + return $this->container['use_threads']; + } + + /** + * Sets use_threads + * + * @param bool|null $use_threads If alias will generate response threads or not when email are received by it + * + * @return self + */ + public function setUseThreads($use_threads) + { + + if (is_null($use_threads)) { + array_push($this->openAPINullablesSetToNull, 'use_threads'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_threads', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_threads'] = $use_threads; + + return $this; + } + + /** + * Gets is_verified + * + * @return bool + */ + public function getIsVerified() + { + return $this->container['is_verified']; + } + + /** + * Sets is_verified + * + * @param bool $is_verified Has the alias been verified. You must verify an alias if the masked email address has not yet been verified by your account + * + * @return self + */ + public function setIsVerified($is_verified) + { + + if (is_null($is_verified)) { + throw new \InvalidArgumentException('non-nullable is_verified cannot be null'); + } + + $this->container['is_verified'] = $is_verified; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + array_push($this->openAPINullablesSetToNull, 'created_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('created_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + array_push($this->openAPINullablesSetToNull, 'updated_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updated_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/AliasProjection.php b/lib/Models/AliasProjection.php new file mode 100644 index 00000000..b6f7f42b --- /dev/null +++ b/lib/Models/AliasProjection.php @@ -0,0 +1,683 @@ + + */ +class AliasProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AliasProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'inbox_id' => 'string', + 'user_id' => 'string', + 'email_address' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'use_threads' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'inbox_id' => 'uuid', + 'user_id' => 'uuid', + 'email_address' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'use_threads' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'inbox_id' => false, + 'user_id' => false, + 'email_address' => false, + 'created_at' => false, + 'updated_at' => false, + 'use_threads' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'inbox_id' => 'inboxId', + 'user_id' => 'userId', + 'email_address' => 'emailAddress', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'use_threads' => 'useThreads' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'inbox_id' => 'setInboxId', + 'user_id' => 'setUserId', + 'email_address' => 'setEmailAddress', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'use_threads' => 'setUseThreads' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'inbox_id' => 'getInboxId', + 'user_id' => 'getUserId', + 'email_address' => 'getEmailAddress', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'use_threads' => 'getUseThreads' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('use_threads', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets use_threads + * + * @return bool|null + */ + public function getUseThreads() + { + return $this->container['use_threads']; + } + + /** + * Sets use_threads + * + * @param bool|null $use_threads use_threads + * + * @return self + */ + public function setUseThreads($use_threads) + { + + if (is_null($use_threads)) { + throw new \InvalidArgumentException('non-nullable use_threads cannot be null'); + } + + $this->container['use_threads'] = $use_threads; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/AttachmentEntity.php b/lib/Models/AttachmentEntity.php new file mode 100644 index 00000000..f35572fd --- /dev/null +++ b/lib/Models/AttachmentEntity.php @@ -0,0 +1,712 @@ + + */ +class AttachmentEntity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AttachmentEntity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'attachment_id' => 'string', + 'bucket' => 'string', + 'user_id' => 'string', + 'content_type' => 'string', + 'content_length' => 'int', + 'name' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'attachment_id' => null, + 'bucket' => null, + 'user_id' => 'uuid', + 'content_type' => null, + 'content_length' => 'int64', + 'name' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'attachment_id' => false, + 'bucket' => false, + 'user_id' => false, + 'content_type' => false, + 'content_length' => false, + 'name' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'attachment_id' => 'attachmentId', + 'bucket' => 'bucket', + 'user_id' => 'userId', + 'content_type' => 'contentType', + 'content_length' => 'contentLength', + 'name' => 'name', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'attachment_id' => 'setAttachmentId', + 'bucket' => 'setBucket', + 'user_id' => 'setUserId', + 'content_type' => 'setContentType', + 'content_length' => 'setContentLength', + 'name' => 'setName', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'attachment_id' => 'getAttachmentId', + 'bucket' => 'getBucket', + 'user_id' => 'getUserId', + 'content_type' => 'getContentType', + 'content_length' => 'getContentLength', + 'name' => 'getName', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('bucket', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('content_length', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attachment_id'] === null) { + $invalidProperties[] = "'attachment_id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets attachment_id + * + * @return string + */ + public function getAttachmentId() + { + return $this->container['attachment_id']; + } + + /** + * Sets attachment_id + * + * @param string $attachment_id attachment_id + * + * @return self + */ + public function setAttachmentId($attachment_id) + { + + if (is_null($attachment_id)) { + throw new \InvalidArgumentException('non-nullable attachment_id cannot be null'); + } + + $this->container['attachment_id'] = $attachment_id; + + return $this; + } + + /** + * Gets bucket + * + * @return string|null + */ + public function getBucket() + { + return $this->container['bucket']; + } + + /** + * Sets bucket + * + * @param string|null $bucket bucket + * + * @return self + */ + public function setBucket($bucket) + { + + if (is_null($bucket)) { + throw new \InvalidArgumentException('non-nullable bucket cannot be null'); + } + + $this->container['bucket'] = $bucket; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets content_length + * + * @return int|null + */ + public function getContentLength() + { + return $this->container['content_length']; + } + + /** + * Sets content_length + * + * @param int|null $content_length content_length + * + * @return self + */ + public function setContentLength($content_length) + { + + if (is_null($content_length)) { + throw new \InvalidArgumentException('non-nullable content_length cannot be null'); + } + + $this->container['content_length'] = $content_length; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/AttachmentMetaData.php b/lib/Models/AttachmentMetaData.php new file mode 100644 index 00000000..8c25cbaf --- /dev/null +++ b/lib/Models/AttachmentMetaData.php @@ -0,0 +1,533 @@ + + */ +class AttachmentMetaData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AttachmentMetaData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'content_type' => 'string', + 'content_length' => 'int', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'content_type' => null, + 'content_length' => 'int64', + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'content_type' => false, + 'content_length' => false, + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'content_type' => 'contentType', + 'content_length' => 'contentLength', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'content_type' => 'setContentType', + 'content_length' => 'setContentLength', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'content_type' => 'getContentType', + 'content_length' => 'getContentLength', + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('content_length', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['content_type'] === null) { + $invalidProperties[] = "'content_type' can't be null"; + } + if ($this->container['content_length'] === null) { + $invalidProperties[] = "'content_length' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of attachment if given + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets content_type + * + * @return string + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string $content_type Content type of attachment such as `image/png` + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets content_length + * + * @return int + */ + public function getContentLength() + { + return $this->container['content_length']; + } + + /** + * Sets content_length + * + * @param int $content_length Size of attachment in bytes + * + * @return self + */ + public function setContentLength($content_length) + { + + if (is_null($content_length)) { + throw new \InvalidArgumentException('non-nullable content_length cannot be null'); + } + + $this->container['content_length'] = $content_length; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of attachment. Can be used to with attachment controller endpoints to download attachment or with sending methods to attach to an email. + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/AttachmentProjection.php b/lib/Models/AttachmentProjection.php new file mode 100644 index 00000000..0d73100f --- /dev/null +++ b/lib/Models/AttachmentProjection.php @@ -0,0 +1,662 @@ + + */ +class AttachmentProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AttachmentProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'content_length' => 'int', + 'content_type' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'attachment_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'content_length' => 'int64', + 'content_type' => null, + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'attachment_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'content_length' => true, + 'content_type' => true, + 'user_id' => false, + 'created_at' => false, + 'updated_at' => false, + 'attachment_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'content_length' => 'contentLength', + 'content_type' => 'contentType', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'attachment_id' => 'attachmentId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'content_length' => 'setContentLength', + 'content_type' => 'setContentType', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'attachment_id' => 'setAttachmentId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'content_length' => 'getContentLength', + 'content_type' => 'getContentType', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'attachment_id' => 'getAttachmentId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('content_length', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['attachment_id'] === null) { + $invalidProperties[] = "'attachment_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets content_length + * + * @return int|null + */ + public function getContentLength() + { + return $this->container['content_length']; + } + + /** + * Sets content_length + * + * @param int|null $content_length Content length of attachment in bytes + * + * @return self + */ + public function setContentLength($content_length) + { + + if (is_null($content_length)) { + array_push($this->openAPINullablesSetToNull, 'content_length'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('content_length', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['content_length'] = $content_length; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type Content type of attachment. + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + array_push($this->openAPINullablesSetToNull, 'content_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('content_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets attachment_id + * + * @return string + */ + public function getAttachmentId() + { + return $this->container['attachment_id']; + } + + /** + * Sets attachment_id + * + * @param string $attachment_id Attachment ID + * + * @return self + */ + public function setAttachmentId($attachment_id) + { + + if (is_null($attachment_id)) { + throw new \InvalidArgumentException('non-nullable attachment_id cannot be null'); + } + + $this->container['attachment_id'] = $attachment_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BasicAuthOptions.php b/lib/Models/BasicAuthOptions.php new file mode 100644 index 00000000..448fe4d4 --- /dev/null +++ b/lib/Models/BasicAuthOptions.php @@ -0,0 +1,455 @@ + + */ +class BasicAuthOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BasicAuthOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'username' => 'string', + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'username' => null, + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'username' => 'username', + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'username' => 'setUsername', + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'username' => 'getUsername', + 'password' => 'getPassword' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets username + * + * @return string + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username username + * + * @return self + */ + public function setUsername($username) + { + + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return self + */ + public function setPassword($password) + { + + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BounceProjection.php b/lib/Models/BounceProjection.php new file mode 100644 index 00000000..07810f6f --- /dev/null +++ b/lib/Models/BounceProjection.php @@ -0,0 +1,620 @@ + + */ +class BounceProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BounceProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sender' => 'string', + 'subject' => 'string', + 'created_at' => '\DateTime', + 'bounce_type' => 'string', + 'bounce_mta' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'sender' => null, + 'subject' => null, + 'created_at' => 'date-time', + 'bounce_type' => null, + 'bounce_mta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'sender' => false, + 'subject' => true, + 'created_at' => false, + 'bounce_type' => true, + 'bounce_mta' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'sender' => 'sender', + 'subject' => 'subject', + 'created_at' => 'createdAt', + 'bounce_type' => 'bounceType', + 'bounce_mta' => 'bounceMta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sender' => 'setSender', + 'subject' => 'setSubject', + 'created_at' => 'setCreatedAt', + 'bounce_type' => 'setBounceType', + 'bounce_mta' => 'setBounceMta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sender' => 'getSender', + 'subject' => 'getSubject', + 'created_at' => 'getCreatedAt', + 'bounce_type' => 'getBounceType', + 'bounce_mta' => 'getBounceMta' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('bounce_type', $data ?? [], null); + $this->setIfExists('bounce_mta', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sender + * + * @return string + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string $sender sender + * + * @return self + */ + public function setSender($sender) + { + + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets bounce_type + * + * @return string|null + */ + public function getBounceType() + { + return $this->container['bounce_type']; + } + + /** + * Sets bounce_type + * + * @param string|null $bounce_type bounce_type + * + * @return self + */ + public function setBounceType($bounce_type) + { + + if (is_null($bounce_type)) { + array_push($this->openAPINullablesSetToNull, 'bounce_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_type'] = $bounce_type; + + return $this; + } + + /** + * Gets bounce_mta + * + * @return string|null + */ + public function getBounceMta() + { + return $this->container['bounce_mta']; + } + + /** + * Sets bounce_mta + * + * @param string|null $bounce_mta bounce_mta + * + * @return self + */ + public function setBounceMta($bounce_mta) + { + + if (is_null($bounce_mta)) { + array_push($this->openAPINullablesSetToNull, 'bounce_mta'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_mta', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_mta'] = $bounce_mta; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BounceRecipientProjection.php b/lib/Models/BounceRecipientProjection.php new file mode 100644 index 00000000..92352f65 --- /dev/null +++ b/lib/Models/BounceRecipientProjection.php @@ -0,0 +1,620 @@ + + */ +class BounceRecipientProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BounceRecipientProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'created_at' => '\DateTime', + 'sent_email_id' => 'string', + 'recipient' => 'string', + 'action' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'status' => null, + 'created_at' => 'date-time', + 'sent_email_id' => 'uuid', + 'recipient' => null, + 'action' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => true, + 'created_at' => false, + 'sent_email_id' => true, + 'recipient' => false, + 'action' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'created_at' => 'createdAt', + 'sent_email_id' => 'sentEmailId', + 'recipient' => 'recipient', + 'action' => 'action' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'created_at' => 'setCreatedAt', + 'sent_email_id' => 'setSentEmailId', + 'recipient' => 'setRecipient', + 'action' => 'setAction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'created_at' => 'getCreatedAt', + 'sent_email_id' => 'getSentEmailId', + 'recipient' => 'getRecipient', + 'action' => 'getAction' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['recipient'] === null) { + $invalidProperties[] = "'recipient' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string|null + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string|null $sent_email_id sent_email_id + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + array_push($this->openAPINullablesSetToNull, 'sent_email_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_email_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets recipient + * + * @return string + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string $recipient recipient + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + throw new \InvalidArgumentException('non-nullable recipient cannot be null'); + } + + $this->container['recipient'] = $recipient; + + return $this; + } + + /** + * Gets action + * + * @return string|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string|null $action action + * + * @return self + */ + public function setAction($action) + { + + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['action'] = $action; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BouncedEmailDto.php b/lib/Models/BouncedEmailDto.php new file mode 100644 index 00000000..5f8cc04d --- /dev/null +++ b/lib/Models/BouncedEmailDto.php @@ -0,0 +1,873 @@ + + */ +class BouncedEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BouncedEmailDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'notification_type' => 'string', + 'sent_to_recipients' => 'string[]', + 'sender' => 'string', + 'bounce_mta' => 'string', + 'bounce_type' => 'string', + 'bounce_recipients' => 'string[]', + 'bounce_sub_type' => 'string', + 'sent_email_id' => 'string', + 'subject' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'notification_type' => null, + 'sent_to_recipients' => null, + 'sender' => null, + 'bounce_mta' => null, + 'bounce_type' => null, + 'bounce_recipients' => null, + 'bounce_sub_type' => null, + 'sent_email_id' => 'uuid', + 'subject' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'notification_type' => false, + 'sent_to_recipients' => true, + 'sender' => false, + 'bounce_mta' => true, + 'bounce_type' => true, + 'bounce_recipients' => true, + 'bounce_sub_type' => true, + 'sent_email_id' => true, + 'subject' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'notification_type' => 'notificationType', + 'sent_to_recipients' => 'sentToRecipients', + 'sender' => 'sender', + 'bounce_mta' => 'bounceMta', + 'bounce_type' => 'bounceType', + 'bounce_recipients' => 'bounceRecipients', + 'bounce_sub_type' => 'bounceSubType', + 'sent_email_id' => 'sentEmailId', + 'subject' => 'subject', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'notification_type' => 'setNotificationType', + 'sent_to_recipients' => 'setSentToRecipients', + 'sender' => 'setSender', + 'bounce_mta' => 'setBounceMta', + 'bounce_type' => 'setBounceType', + 'bounce_recipients' => 'setBounceRecipients', + 'bounce_sub_type' => 'setBounceSubType', + 'sent_email_id' => 'setSentEmailId', + 'subject' => 'setSubject', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'notification_type' => 'getNotificationType', + 'sent_to_recipients' => 'getSentToRecipients', + 'sender' => 'getSender', + 'bounce_mta' => 'getBounceMta', + 'bounce_type' => 'getBounceType', + 'bounce_recipients' => 'getBounceRecipients', + 'bounce_sub_type' => 'getBounceSubType', + 'sent_email_id' => 'getSentEmailId', + 'subject' => 'getSubject', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('notification_type', $data ?? [], null); + $this->setIfExists('sent_to_recipients', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('bounce_mta', $data ?? [], null); + $this->setIfExists('bounce_type', $data ?? [], null); + $this->setIfExists('bounce_recipients', $data ?? [], null); + $this->setIfExists('bounce_sub_type', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['notification_type'] === null) { + $invalidProperties[] = "'notification_type' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets notification_type + * + * @return string + */ + public function getNotificationType() + { + return $this->container['notification_type']; + } + + /** + * Sets notification_type + * + * @param string $notification_type notification_type + * + * @return self + */ + public function setNotificationType($notification_type) + { + + if (is_null($notification_type)) { + throw new \InvalidArgumentException('non-nullable notification_type cannot be null'); + } + + $this->container['notification_type'] = $notification_type; + + return $this; + } + + /** + * Gets sent_to_recipients + * + * @return string[]|null + */ + public function getSentToRecipients() + { + return $this->container['sent_to_recipients']; + } + + /** + * Sets sent_to_recipients + * + * @param string[]|null $sent_to_recipients sent_to_recipients + * + * @return self + */ + public function setSentToRecipients($sent_to_recipients) + { + + if (is_null($sent_to_recipients)) { + array_push($this->openAPINullablesSetToNull, 'sent_to_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_to_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_to_recipients'] = $sent_to_recipients; + + return $this; + } + + /** + * Gets sender + * + * @return string + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string $sender sender + * + * @return self + */ + public function setSender($sender) + { + + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets bounce_mta + * + * @return string|null + */ + public function getBounceMta() + { + return $this->container['bounce_mta']; + } + + /** + * Sets bounce_mta + * + * @param string|null $bounce_mta bounce_mta + * + * @return self + */ + public function setBounceMta($bounce_mta) + { + + if (is_null($bounce_mta)) { + array_push($this->openAPINullablesSetToNull, 'bounce_mta'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_mta', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_mta'] = $bounce_mta; + + return $this; + } + + /** + * Gets bounce_type + * + * @return string|null + */ + public function getBounceType() + { + return $this->container['bounce_type']; + } + + /** + * Sets bounce_type + * + * @param string|null $bounce_type bounce_type + * + * @return self + */ + public function setBounceType($bounce_type) + { + + if (is_null($bounce_type)) { + array_push($this->openAPINullablesSetToNull, 'bounce_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_type'] = $bounce_type; + + return $this; + } + + /** + * Gets bounce_recipients + * + * @return string[]|null + */ + public function getBounceRecipients() + { + return $this->container['bounce_recipients']; + } + + /** + * Sets bounce_recipients + * + * @param string[]|null $bounce_recipients bounce_recipients + * + * @return self + */ + public function setBounceRecipients($bounce_recipients) + { + + if (is_null($bounce_recipients)) { + array_push($this->openAPINullablesSetToNull, 'bounce_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_recipients'] = $bounce_recipients; + + return $this; + } + + /** + * Gets bounce_sub_type + * + * @return string|null + */ + public function getBounceSubType() + { + return $this->container['bounce_sub_type']; + } + + /** + * Sets bounce_sub_type + * + * @param string|null $bounce_sub_type bounce_sub_type + * + * @return self + */ + public function setBounceSubType($bounce_sub_type) + { + + if (is_null($bounce_sub_type)) { + array_push($this->openAPINullablesSetToNull, 'bounce_sub_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_sub_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_sub_type'] = $bounce_sub_type; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string|null + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string|null $sent_email_id sent_email_id + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + array_push($this->openAPINullablesSetToNull, 'sent_email_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_email_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BouncedRecipientDto.php b/lib/Models/BouncedRecipientDto.php new file mode 100644 index 00000000..61193e84 --- /dev/null +++ b/lib/Models/BouncedRecipientDto.php @@ -0,0 +1,709 @@ + + */ +class BouncedRecipientDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BouncedRecipientDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'sent_email_id' => 'string', + 'recipient' => 'string', + 'diagnostic_code' => 'string', + 'action' => 'string', + 'status' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'sent_email_id' => 'uuid', + 'recipient' => null, + 'diagnostic_code' => null, + 'action' => null, + 'status' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => true, + 'sent_email_id' => true, + 'recipient' => false, + 'diagnostic_code' => true, + 'action' => true, + 'status' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'sent_email_id' => 'sentEmailId', + 'recipient' => 'recipient', + 'diagnostic_code' => 'diagnosticCode', + 'action' => 'action', + 'status' => 'status', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'sent_email_id' => 'setSentEmailId', + 'recipient' => 'setRecipient', + 'diagnostic_code' => 'setDiagnosticCode', + 'action' => 'setAction', + 'status' => 'setStatus', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'sent_email_id' => 'getSentEmailId', + 'recipient' => 'getRecipient', + 'diagnostic_code' => 'getDiagnosticCode', + 'action' => 'getAction', + 'status' => 'getStatus', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('diagnostic_code', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['recipient'] === null) { + $invalidProperties[] = "'recipient' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + array_push($this->openAPINullablesSetToNull, 'user_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('user_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string|null + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string|null $sent_email_id sent_email_id + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + array_push($this->openAPINullablesSetToNull, 'sent_email_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_email_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets recipient + * + * @return string + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string $recipient recipient + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + throw new \InvalidArgumentException('non-nullable recipient cannot be null'); + } + + $this->container['recipient'] = $recipient; + + return $this; + } + + /** + * Gets diagnostic_code + * + * @return string|null + */ + public function getDiagnosticCode() + { + return $this->container['diagnostic_code']; + } + + /** + * Sets diagnostic_code + * + * @param string|null $diagnostic_code diagnostic_code + * + * @return self + */ + public function setDiagnosticCode($diagnostic_code) + { + + if (is_null($diagnostic_code)) { + array_push($this->openAPINullablesSetToNull, 'diagnostic_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('diagnostic_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['diagnostic_code'] = $diagnostic_code; + + return $this; + } + + /** + * Gets action + * + * @return string|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string|null $action action + * + * @return self + */ + public function setAction($action) + { + + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/BulkSendEmailOptions.php b/lib/Models/BulkSendEmailOptions.php new file mode 100644 index 00000000..a0c66c01 --- /dev/null +++ b/lib/Models/BulkSendEmailOptions.php @@ -0,0 +1,455 @@ + + */ +class BulkSendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkSendEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_ids' => 'string[]', + 'send_email_options' => '\MailSlurp\Models\SendEmailOptions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_ids' => 'uuid', + 'send_email_options' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_ids' => false, + 'send_email_options' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_ids' => 'inboxIds', + 'send_email_options' => 'sendEmailOptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_ids' => 'setInboxIds', + 'send_email_options' => 'setSendEmailOptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_ids' => 'getInboxIds', + 'send_email_options' => 'getSendEmailOptions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_ids', $data ?? [], null); + $this->setIfExists('send_email_options', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_ids'] === null) { + $invalidProperties[] = "'inbox_ids' can't be null"; + } + if ($this->container['send_email_options'] === null) { + $invalidProperties[] = "'send_email_options' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_ids + * + * @return string[] + */ + public function getInboxIds() + { + return $this->container['inbox_ids']; + } + + /** + * Sets inbox_ids + * + * @param string[] $inbox_ids Inboxes to send the email from + * + * @return self + */ + public function setInboxIds($inbox_ids) + { + + if (is_null($inbox_ids)) { + throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null'); + } + + $this->container['inbox_ids'] = $inbox_ids; + + return $this; + } + + /** + * Gets send_email_options + * + * @return \MailSlurp\Models\SendEmailOptions + */ + public function getSendEmailOptions() + { + return $this->container['send_email_options']; + } + + /** + * Sets send_email_options + * + * @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options + * + * @return self + */ + public function setSendEmailOptions($send_email_options) + { + + if (is_null($send_email_options)) { + throw new \InvalidArgumentException('non-nullable send_email_options cannot be null'); + } + + $this->container['send_email_options'] = $send_email_options; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/Complaint.php b/lib/Models/Complaint.php new file mode 100644 index 00000000..566763ac --- /dev/null +++ b/lib/Models/Complaint.php @@ -0,0 +1,676 @@ + + */ +class Complaint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Complaint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'event_type' => 'string', + 'mail_source' => 'string', + 'mail_message_id' => 'string', + 'complaint_recipient' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'event_type' => null, + 'mail_source' => null, + 'mail_message_id' => null, + 'complaint_recipient' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'event_type' => false, + 'mail_source' => false, + 'mail_message_id' => false, + 'complaint_recipient' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'event_type' => 'eventType', + 'mail_source' => 'mailSource', + 'mail_message_id' => 'mailMessageId', + 'complaint_recipient' => 'complaintRecipient', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'event_type' => 'setEventType', + 'mail_source' => 'setMailSource', + 'mail_message_id' => 'setMailMessageId', + 'complaint_recipient' => 'setComplaintRecipient', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'event_type' => 'getEventType', + 'mail_source' => 'getMailSource', + 'mail_message_id' => 'getMailMessageId', + 'complaint_recipient' => 'getComplaintRecipient', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('mail_source', $data ?? [], null); + $this->setIfExists('mail_message_id', $data ?? [], null); + $this->setIfExists('complaint_recipient', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['complaint_recipient'] === null) { + $invalidProperties[] = "'complaint_recipient' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets mail_source + * + * @return string|null + */ + public function getMailSource() + { + return $this->container['mail_source']; + } + + /** + * Sets mail_source + * + * @param string|null $mail_source mail_source + * + * @return self + */ + public function setMailSource($mail_source) + { + + if (is_null($mail_source)) { + throw new \InvalidArgumentException('non-nullable mail_source cannot be null'); + } + + $this->container['mail_source'] = $mail_source; + + return $this; + } + + /** + * Gets mail_message_id + * + * @return string|null + */ + public function getMailMessageId() + { + return $this->container['mail_message_id']; + } + + /** + * Sets mail_message_id + * + * @param string|null $mail_message_id mail_message_id + * + * @return self + */ + public function setMailMessageId($mail_message_id) + { + + if (is_null($mail_message_id)) { + throw new \InvalidArgumentException('non-nullable mail_message_id cannot be null'); + } + + $this->container['mail_message_id'] = $mail_message_id; + + return $this; + } + + /** + * Gets complaint_recipient + * + * @return string + */ + public function getComplaintRecipient() + { + return $this->container['complaint_recipient']; + } + + /** + * Sets complaint_recipient + * + * @param string $complaint_recipient complaint_recipient + * + * @return self + */ + public function setComplaintRecipient($complaint_recipient) + { + + if (is_null($complaint_recipient)) { + throw new \InvalidArgumentException('non-nullable complaint_recipient cannot be null'); + } + + $this->container['complaint_recipient'] = $complaint_recipient; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ConditionOption.php b/lib/Models/ConditionOption.php new file mode 100644 index 00000000..f0e4a17e --- /dev/null +++ b/lib/Models/ConditionOption.php @@ -0,0 +1,521 @@ + + */ +class ConditionOption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ConditionOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'condition' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'condition' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'condition' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'condition' => 'condition', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'condition' => 'setCondition', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'condition' => 'getCondition', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CONDITION_HAS_ATTACHMENTS = 'HAS_ATTACHMENTS'; + public const VALUE_TRUE = 'TRUE'; + public const VALUE_FALSE = 'FALSE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConditionAllowableValues() + { + return [ + self::CONDITION_HAS_ATTACHMENTS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValueAllowableValues() + { + return [ + self::VALUE_TRUE, + self::VALUE_FALSE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('condition', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['condition'] === null) { + $invalidProperties[] = "'condition' can't be null"; + } + $allowedValues = $this->getConditionAllowableValues(); + if (!is_null($this->container['condition']) && !in_array($this->container['condition'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'condition', must be one of '%s'", + $this->container['condition'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + $allowedValues = $this->getValueAllowableValues(); + if (!is_null($this->container['value']) && !in_array($this->container['value'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'value', must be one of '%s'", + $this->container['value'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets condition + * + * @return string + */ + public function getCondition() + { + return $this->container['condition']; + } + + /** + * Sets condition + * + * @param string $condition Condition of an email object that can be used to filter results + * + * @return self + */ + public function setCondition($condition) + { + $allowedValues = $this->getConditionAllowableValues(); + if (!in_array($condition, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'condition', must be one of '%s'", + $condition, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($condition)) { + throw new \InvalidArgumentException('non-nullable condition cannot be null'); + } + + $this->container['condition'] = $condition; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value Expected condition value + * + * @return self + */ + public function setValue($value) + { + $allowedValues = $this->getValueAllowableValues(); + if (!in_array($value, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'value', must be one of '%s'", + $value, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ContactDto.php b/lib/Models/ContactDto.php new file mode 100644 index 00000000..a713fd9f --- /dev/null +++ b/lib/Models/ContactDto.php @@ -0,0 +1,834 @@ + + */ +class ContactDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'group_id' => 'string', + 'first_name' => 'string', + 'last_name' => 'string', + 'company' => 'string', + 'email_addresses' => 'string[]', + 'primary_email_address' => 'string', + 'tags' => 'string[]', + 'meta_data' => 'object', + 'opt_out' => 'bool', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'group_id' => 'uuid', + 'first_name' => null, + 'last_name' => null, + 'company' => null, + 'email_addresses' => null, + 'primary_email_address' => null, + 'tags' => null, + 'meta_data' => null, + 'opt_out' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'group_id' => true, + 'first_name' => true, + 'last_name' => true, + 'company' => true, + 'email_addresses' => false, + 'primary_email_address' => true, + 'tags' => false, + 'meta_data' => true, + 'opt_out' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'group_id' => 'groupId', + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'company' => 'company', + 'email_addresses' => 'emailAddresses', + 'primary_email_address' => 'primaryEmailAddress', + 'tags' => 'tags', + 'meta_data' => 'metaData', + 'opt_out' => 'optOut', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'group_id' => 'setGroupId', + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'company' => 'setCompany', + 'email_addresses' => 'setEmailAddresses', + 'primary_email_address' => 'setPrimaryEmailAddress', + 'tags' => 'setTags', + 'meta_data' => 'setMetaData', + 'opt_out' => 'setOptOut', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'group_id' => 'getGroupId', + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'company' => 'getCompany', + 'email_addresses' => 'getEmailAddresses', + 'primary_email_address' => 'getPrimaryEmailAddress', + 'tags' => 'getTags', + 'meta_data' => 'getMetaData', + 'opt_out' => 'getOptOut', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('primary_email_address', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('meta_data', $data ?? [], null); + $this->setIfExists('opt_out', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email_addresses'] === null) { + $invalidProperties[] = "'email_addresses' can't be null"; + } + if ($this->container['tags'] === null) { + $invalidProperties[] = "'tags' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets group_id + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string|null $group_id group_id + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + array_push($this->openAPINullablesSetToNull, 'group_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['group_id'] = $group_id; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company company + * + * @return self + */ + public function setCompany($company) + { + + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets email_addresses + * + * @return string[] + */ + public function getEmailAddresses() + { + return $this->container['email_addresses']; + } + + /** + * Sets email_addresses + * + * @param string[] $email_addresses email_addresses + * + * @return self + */ + public function setEmailAddresses($email_addresses) + { + + if (is_null($email_addresses)) { + throw new \InvalidArgumentException('non-nullable email_addresses cannot be null'); + } + + $this->container['email_addresses'] = $email_addresses; + + return $this; + } + + /** + * Gets primary_email_address + * + * @return string|null + */ + public function getPrimaryEmailAddress() + { + return $this->container['primary_email_address']; + } + + /** + * Sets primary_email_address + * + * @param string|null $primary_email_address primary_email_address + * + * @return self + */ + public function setPrimaryEmailAddress($primary_email_address) + { + + if (is_null($primary_email_address)) { + array_push($this->openAPINullablesSetToNull, 'primary_email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('primary_email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['primary_email_address'] = $primary_email_address; + + return $this; + } + + /** + * Gets tags + * + * @return string[] + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[] $tags tags + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets meta_data + * + * @return object|null + */ + public function getMetaData() + { + return $this->container['meta_data']; + } + + /** + * Sets meta_data + * + * @param object|null $meta_data meta_data + * + * @return self + */ + public function setMetaData($meta_data) + { + + if (is_null($meta_data)) { + array_push($this->openAPINullablesSetToNull, 'meta_data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('meta_data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['meta_data'] = $meta_data; + + return $this; + } + + /** + * Gets opt_out + * + * @return bool|null + */ + public function getOptOut() + { + return $this->container['opt_out']; + } + + /** + * Sets opt_out + * + * @param bool|null $opt_out opt_out + * + * @return self + */ + public function setOptOut($opt_out) + { + + if (is_null($opt_out)) { + array_push($this->openAPINullablesSetToNull, 'opt_out'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('opt_out', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['opt_out'] = $opt_out; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ContactProjection.php b/lib/Models/ContactProjection.php new file mode 100644 index 00000000..51494e64 --- /dev/null +++ b/lib/Models/ContactProjection.php @@ -0,0 +1,709 @@ + + */ +class ContactProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'group_id' => 'string', + 'created_at' => '\DateTime', + 'first_name' => 'string', + 'last_name' => 'string', + 'company' => 'string', + 'email_addresses' => 'string[]', + 'opt_out' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'group_id' => 'uuid', + 'created_at' => 'date-time', + 'first_name' => null, + 'last_name' => null, + 'company' => null, + 'email_addresses' => null, + 'opt_out' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'group_id' => true, + 'created_at' => false, + 'first_name' => true, + 'last_name' => true, + 'company' => true, + 'email_addresses' => true, + 'opt_out' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'group_id' => 'groupId', + 'created_at' => 'createdAt', + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'company' => 'company', + 'email_addresses' => 'emailAddresses', + 'opt_out' => 'optOut' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'group_id' => 'setGroupId', + 'created_at' => 'setCreatedAt', + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'company' => 'setCompany', + 'email_addresses' => 'setEmailAddresses', + 'opt_out' => 'setOptOut' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'group_id' => 'getGroupId', + 'created_at' => 'getCreatedAt', + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'company' => 'getCompany', + 'email_addresses' => 'getEmailAddresses', + 'opt_out' => 'getOptOut' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('opt_out', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['opt_out'] === null) { + $invalidProperties[] = "'opt_out' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets group_id + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string|null $group_id group_id + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + array_push($this->openAPINullablesSetToNull, 'group_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['group_id'] = $group_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company company + * + * @return self + */ + public function setCompany($company) + { + + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets email_addresses + * + * @return string[]|null + */ + public function getEmailAddresses() + { + return $this->container['email_addresses']; + } + + /** + * Sets email_addresses + * + * @param string[]|null $email_addresses email_addresses + * + * @return self + */ + public function setEmailAddresses($email_addresses) + { + + if (is_null($email_addresses)) { + array_push($this->openAPINullablesSetToNull, 'email_addresses'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_addresses', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_addresses'] = $email_addresses; + + return $this; + } + + /** + * Gets opt_out + * + * @return bool + */ + public function getOptOut() + { + return $this->container['opt_out']; + } + + /** + * Sets opt_out + * + * @param bool $opt_out opt_out + * + * @return self + */ + public function setOptOut($opt_out) + { + + if (is_null($opt_out)) { + throw new \InvalidArgumentException('non-nullable opt_out cannot be null'); + } + + $this->container['opt_out'] = $opt_out; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ContentMatchOptions.php b/lib/Models/ContentMatchOptions.php new file mode 100644 index 00000000..294e7190 --- /dev/null +++ b/lib/Models/ContentMatchOptions.php @@ -0,0 +1,416 @@ + + */ +class ContentMatchOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContentMatchOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'pattern' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'pattern' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pattern' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'pattern' => 'pattern' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'pattern' => 'setPattern' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'pattern' => 'getPattern' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('pattern', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['pattern'] === null) { + $invalidProperties[] = "'pattern' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets pattern + * + * @return string + */ + public function getPattern() + { + return $this->container['pattern']; + } + + /** + * Sets pattern + * + * @param string $pattern Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. + * + * @return self + */ + public function setPattern($pattern) + { + + if (is_null($pattern)) { + throw new \InvalidArgumentException('non-nullable pattern cannot be null'); + } + + $this->container['pattern'] = $pattern; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CountDto.php b/lib/Models/CountDto.php new file mode 100644 index 00000000..46da57c3 --- /dev/null +++ b/lib/Models/CountDto.php @@ -0,0 +1,416 @@ + + */ +class CountDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total_elements' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total_elements' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_elements' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total_elements' => 'totalElements' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total_elements' => 'setTotalElements' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total_elements' => 'getTotalElements' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('total_elements', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['total_elements'] === null) { + $invalidProperties[] = "'total_elements' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total_elements + * + * @return int + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateAliasOptions.php b/lib/Models/CreateAliasOptions.php new file mode 100644 index 00000000..90d53376 --- /dev/null +++ b/lib/Models/CreateAliasOptions.php @@ -0,0 +1,541 @@ + + */ +class CreateAliasOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateAliasOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_address' => 'string', + 'inbox_id' => 'string', + 'name' => 'string', + 'use_threads' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_address' => null, + 'inbox_id' => 'uuid', + 'name' => null, + 'use_threads' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + 'inbox_id' => true, + 'name' => true, + 'use_threads' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_address' => 'emailAddress', + 'inbox_id' => 'inboxId', + 'name' => 'name', + 'use_threads' => 'useThreads' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_address' => 'setEmailAddress', + 'inbox_id' => 'setInboxId', + 'name' => 'setName', + 'use_threads' => 'setUseThreads' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_address' => 'getEmailAddress', + 'inbox_id' => 'getInboxId', + 'name' => 'getName', + 'use_threads' => 'getUseThreads' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('use_threads', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['use_threads'] === null) { + $invalidProperties[] = "'use_threads' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address Email address to be hidden behind alias. Emails sent to the alias email address will be forwarded to this address. If you want to enable replies set useThreads true and the reply-to for the email will allow outbound communication via a thread. + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id Optional inbox ID to attach to alias. Null by default means an a new inbox will be created for the alias. Use a custom inbox to control what email address the alias uses. To use custom email addresses create a domain and an inbox, the use the inbox ID with this call. Emails received by this inbox will be forwarded to the alias email address + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Optional name for alias + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets use_threads + * + * @return bool + */ + public function getUseThreads() + { + return $this->container['use_threads']; + } + + /** + * Sets use_threads + * + * @param bool $use_threads Enable threads options. If true emails will be sent with a unique reply-to thread address. This means you can reply to the forwarded email and it will be sent to the recipients via your alias address. That way a thread conversation is preserved. + * + * @return self + */ + public function setUseThreads($use_threads) + { + + if (is_null($use_threads)) { + throw new \InvalidArgumentException('non-nullable use_threads cannot be null'); + } + + $this->container['use_threads'] = $use_threads; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateContactOptions.php b/lib/Models/CreateContactOptions.php new file mode 100644 index 00000000..0f594fd7 --- /dev/null +++ b/lib/Models/CreateContactOptions.php @@ -0,0 +1,736 @@ + + */ +class CreateContactOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateContactOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'first_name' => 'string', + 'last_name' => 'string', + 'company' => 'string', + 'email_addresses' => 'string[]', + 'tags' => 'string[]', + 'meta_data' => 'object', + 'opt_out' => 'bool', + 'group_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'first_name' => null, + 'last_name' => null, + 'company' => null, + 'email_addresses' => null, + 'tags' => null, + 'meta_data' => null, + 'opt_out' => null, + 'group_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'first_name' => true, + 'last_name' => true, + 'company' => true, + 'email_addresses' => true, + 'tags' => true, + 'meta_data' => true, + 'opt_out' => true, + 'group_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'company' => 'company', + 'email_addresses' => 'emailAddresses', + 'tags' => 'tags', + 'meta_data' => 'metaData', + 'opt_out' => 'optOut', + 'group_id' => 'groupId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'company' => 'setCompany', + 'email_addresses' => 'setEmailAddresses', + 'tags' => 'setTags', + 'meta_data' => 'setMetaData', + 'opt_out' => 'setOptOut', + 'group_id' => 'setGroupId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'company' => 'getCompany', + 'email_addresses' => 'getEmailAddresses', + 'tags' => 'getTags', + 'meta_data' => 'getMetaData', + 'opt_out' => 'getOptOut', + 'group_id' => 'getGroupId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('meta_data', $data ?? [], null); + $this->setIfExists('opt_out', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['email_addresses']) && (count($this->container['email_addresses']) > 1)) { + $invalidProperties[] = "invalid value for 'email_addresses', number of items must be less than or equal to 1."; + } + + if (!is_null($this->container['email_addresses']) && (count($this->container['email_addresses']) < 0)) { + $invalidProperties[] = "invalid value for 'email_addresses', number of items must be greater than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company company + * + * @return self + */ + public function setCompany($company) + { + + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets email_addresses + * + * @return string[]|null + */ + public function getEmailAddresses() + { + return $this->container['email_addresses']; + } + + /** + * Sets email_addresses + * + * @param string[]|null $email_addresses Set of email addresses belonging to the contact + * + * @return self + */ + public function setEmailAddresses($email_addresses) + { + + if (!is_null($email_addresses) && (count($email_addresses) > 1)) { + throw new \InvalidArgumentException('invalid value for $email_addresses when calling CreateContactOptions., number of items must be less than or equal to 1.'); + } + if (!is_null($email_addresses) && (count($email_addresses) < 0)) { + throw new \InvalidArgumentException('invalid length for $email_addresses when calling CreateContactOptions., number of items must be greater than or equal to 0.'); + } + + if (is_null($email_addresses)) { + array_push($this->openAPINullablesSetToNull, 'email_addresses'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_addresses', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_addresses'] = $email_addresses; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that can be used to search and group contacts + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets meta_data + * + * @return object|null + */ + public function getMetaData() + { + return $this->container['meta_data']; + } + + /** + * Sets meta_data + * + * @param object|null $meta_data meta_data + * + * @return self + */ + public function setMetaData($meta_data) + { + + if (is_null($meta_data)) { + array_push($this->openAPINullablesSetToNull, 'meta_data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('meta_data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['meta_data'] = $meta_data; + + return $this; + } + + /** + * Gets opt_out + * + * @return bool|null + */ + public function getOptOut() + { + return $this->container['opt_out']; + } + + /** + * Sets opt_out + * + * @param bool|null $opt_out Has the user explicitly or implicitly opted out of being contacted? If so MailSlurp will ignore them in all actions. + * + * @return self + */ + public function setOptOut($opt_out) + { + + if (is_null($opt_out)) { + array_push($this->openAPINullablesSetToNull, 'opt_out'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('opt_out', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['opt_out'] = $opt_out; + + return $this; + } + + /** + * Gets group_id + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string|null $group_id Group IDs that contact belongs to + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + array_push($this->openAPINullablesSetToNull, 'group_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['group_id'] = $group_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateDomainOptions.php b/lib/Models/CreateDomainOptions.php new file mode 100644 index 00000000..2c5db92d --- /dev/null +++ b/lib/Models/CreateDomainOptions.php @@ -0,0 +1,579 @@ + + */ +class CreateDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateDomainOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'domain' => 'string', + 'description' => 'string', + 'created_catch_all_inbox' => 'bool', + 'domain_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'domain' => null, + 'description' => null, + 'created_catch_all_inbox' => null, + 'domain_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'domain' => false, + 'description' => true, + 'created_catch_all_inbox' => true, + 'domain_type' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'domain' => 'domain', + 'description' => 'description', + 'created_catch_all_inbox' => 'createdCatchAllInbox', + 'domain_type' => 'domainType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'domain' => 'setDomain', + 'description' => 'setDescription', + 'created_catch_all_inbox' => 'setCreatedCatchAllInbox', + 'domain_type' => 'setDomainType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'domain' => 'getDomain', + 'description' => 'getDescription', + 'created_catch_all_inbox' => 'getCreatedCatchAllInbox', + 'domain_type' => 'getDomainType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDomainTypeAllowableValues() + { + return [ + self::DOMAIN_TYPE_HTTP_INBOX, + self::DOMAIN_TYPE_SMTP_DOMAIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('created_catch_all_inbox', $data ?? [], null); + $this->setIfExists('domain_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'domain_type', must be one of '%s'", + $this->container['domain_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain The top level domain you wish to use with MailSlurp. Do not specify subdomain just the top level. So `test.com` covers all subdomains such as `mail.test.com`. Don't include a protocol such as `http://`. Once added you must complete the verification steps by adding the returned records to your domain. + * + * @return self + */ + public function setDomain($domain) + { + + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Optional description of the domain. + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets created_catch_all_inbox + * + * @return bool|null + */ + public function getCreatedCatchAllInbox() + { + return $this->container['created_catch_all_inbox']; + } + + /** + * Sets created_catch_all_inbox + * + * @param bool|null $created_catch_all_inbox Whether to create a catch all inbox for the domain. Any email sent to an address using your domain that cannot be matched to an existing inbox you created with the domain will be routed to the created catch all inbox. You can access emails using the regular methods on this inbox ID. + * + * @return self + */ + public function setCreatedCatchAllInbox($created_catch_all_inbox) + { + + if (is_null($created_catch_all_inbox)) { + array_push($this->openAPINullablesSetToNull, 'created_catch_all_inbox'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('created_catch_all_inbox', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['created_catch_all_inbox'] = $created_catch_all_inbox; + + return $this; + } + + /** + * Gets domain_type + * + * @return string|null + */ + public function getDomainType() + { + return $this->container['domain_type']; + } + + /** + * Sets domain_type + * + * @param string|null $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. + * + * @return self + */ + public function setDomainType($domain_type) + { + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!is_null($domain_type) && !in_array($domain_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'domain_type', must be one of '%s'", + $domain_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($domain_type)) { + array_push($this->openAPINullablesSetToNull, 'domain_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_type'] = $domain_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateEmergencyAddressOptions.php b/lib/Models/CreateEmergencyAddressOptions.php new file mode 100644 index 00000000..1004983c --- /dev/null +++ b/lib/Models/CreateEmergencyAddressOptions.php @@ -0,0 +1,680 @@ + + */ +class CreateEmergencyAddressOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateEmergencyAddressOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer_name' => 'string', + 'address1' => 'string', + 'city' => 'string', + 'region' => 'string', + 'postal_code' => 'string', + 'iso_country_code' => 'string', + 'display_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer_name' => null, + 'address1' => null, + 'city' => null, + 'region' => null, + 'postal_code' => null, + 'iso_country_code' => null, + 'display_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer_name' => false, + 'address1' => false, + 'city' => false, + 'region' => false, + 'postal_code' => false, + 'iso_country_code' => false, + 'display_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customer_name' => 'customerName', + 'address1' => 'address1', + 'city' => 'city', + 'region' => 'region', + 'postal_code' => 'postalCode', + 'iso_country_code' => 'isoCountryCode', + 'display_name' => 'displayName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer_name' => 'setCustomerName', + 'address1' => 'setAddress1', + 'city' => 'setCity', + 'region' => 'setRegion', + 'postal_code' => 'setPostalCode', + 'iso_country_code' => 'setIsoCountryCode', + 'display_name' => 'setDisplayName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer_name' => 'getCustomerName', + 'address1' => 'getAddress1', + 'city' => 'getCity', + 'region' => 'getRegion', + 'postal_code' => 'getPostalCode', + 'iso_country_code' => 'getIsoCountryCode', + 'display_name' => 'getDisplayName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ISO_COUNTRY_CODE_US = 'US'; + public const ISO_COUNTRY_CODE_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsoCountryCodeAllowableValues() + { + return [ + self::ISO_COUNTRY_CODE_US, + self::ISO_COUNTRY_CODE_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('address1', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + $this->setIfExists('iso_country_code', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customer_name'] === null) { + $invalidProperties[] = "'customer_name' can't be null"; + } + if ($this->container['address1'] === null) { + $invalidProperties[] = "'address1' can't be null"; + } + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ($this->container['region'] === null) { + $invalidProperties[] = "'region' can't be null"; + } + if ($this->container['postal_code'] === null) { + $invalidProperties[] = "'postal_code' can't be null"; + } + if ($this->container['iso_country_code'] === null) { + $invalidProperties[] = "'iso_country_code' can't be null"; + } + $allowedValues = $this->getIsoCountryCodeAllowableValues(); + if (!is_null($this->container['iso_country_code']) && !in_array($this->container['iso_country_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'iso_country_code', must be one of '%s'", + $this->container['iso_country_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customer_name + * + * @return string + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string $customer_name customer_name + * + * @return self + */ + public function setCustomerName($customer_name) + { + + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets address1 + * + * @return string + */ + public function getAddress1() + { + return $this->container['address1']; + } + + /** + * Sets address1 + * + * @param string $address1 address1 + * + * @return self + */ + public function setAddress1($address1) + { + + if (is_null($address1)) { + throw new \InvalidArgumentException('non-nullable address1 cannot be null'); + } + + $this->container['address1'] = $address1; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city city + * + * @return self + */ + public function setCity($city) + { + + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets region + * + * @return string + */ + public function getRegion() + { + return $this->container['region']; + } + + /** + * Sets region + * + * @param string $region region + * + * @return self + */ + public function setRegion($region) + { + + if (is_null($region)) { + throw new \InvalidArgumentException('non-nullable region cannot be null'); + } + + $this->container['region'] = $region; + + return $this; + } + + /** + * Gets postal_code + * + * @return string + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string $postal_code postal_code + * + * @return self + */ + public function setPostalCode($postal_code) + { + + if (is_null($postal_code)) { + throw new \InvalidArgumentException('non-nullable postal_code cannot be null'); + } + + $this->container['postal_code'] = $postal_code; + + return $this; + } + + /** + * Gets iso_country_code + * + * @return string + */ + public function getIsoCountryCode() + { + return $this->container['iso_country_code']; + } + + /** + * Sets iso_country_code + * + * @param string $iso_country_code iso_country_code + * + * @return self + */ + public function setIsoCountryCode($iso_country_code) + { + $allowedValues = $this->getIsoCountryCodeAllowableValues(); + if (!in_array($iso_country_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'iso_country_code', must be one of '%s'", + $iso_country_code, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($iso_country_code)) { + throw new \InvalidArgumentException('non-nullable iso_country_code cannot be null'); + } + + $this->container['iso_country_code'] = $iso_country_code; + + return $this; + } + + /** + * Gets display_name + * + * @return string|null + */ + public function getDisplayName() + { + return $this->container['display_name']; + } + + /** + * Sets display_name + * + * @param string|null $display_name display_name + * + * @return self + */ + public function setDisplayName($display_name) + { + + if (is_null($display_name)) { + throw new \InvalidArgumentException('non-nullable display_name cannot be null'); + } + + $this->container['display_name'] = $display_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateGroupOptions.php b/lib/Models/CreateGroupOptions.php new file mode 100644 index 00000000..1362e692 --- /dev/null +++ b/lib/Models/CreateGroupOptions.php @@ -0,0 +1,459 @@ + + */ +class CreateGroupOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateGroupOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'description' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateInboxDto.php b/lib/Models/CreateInboxDto.php new file mode 100644 index 00000000..2d6289c0 --- /dev/null +++ b/lib/Models/CreateInboxDto.php @@ -0,0 +1,927 @@ + + */ +class CreateInboxDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateInboxDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_address' => 'string', + 'name' => 'string', + 'description' => 'string', + 'use_domain_pool' => 'bool', + 'tags' => 'string[]', + 'expires_at' => '\DateTime', + 'favourite' => 'bool', + 'expires_in' => 'int', + 'allow_team_access' => 'bool', + 'inbox_type' => 'string', + 'virtual_inbox' => 'bool', + 'use_short_address' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_address' => null, + 'name' => null, + 'description' => null, + 'use_domain_pool' => null, + 'tags' => null, + 'expires_at' => 'date-time', + 'favourite' => null, + 'expires_in' => 'int64', + 'allow_team_access' => null, + 'inbox_type' => null, + 'virtual_inbox' => null, + 'use_short_address' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_address' => true, + 'name' => true, + 'description' => true, + 'use_domain_pool' => true, + 'tags' => true, + 'expires_at' => true, + 'favourite' => true, + 'expires_in' => true, + 'allow_team_access' => true, + 'inbox_type' => true, + 'virtual_inbox' => true, + 'use_short_address' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_address' => 'emailAddress', + 'name' => 'name', + 'description' => 'description', + 'use_domain_pool' => 'useDomainPool', + 'tags' => 'tags', + 'expires_at' => 'expiresAt', + 'favourite' => 'favourite', + 'expires_in' => 'expiresIn', + 'allow_team_access' => 'allowTeamAccess', + 'inbox_type' => 'inboxType', + 'virtual_inbox' => 'virtualInbox', + 'use_short_address' => 'useShortAddress' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_address' => 'setEmailAddress', + 'name' => 'setName', + 'description' => 'setDescription', + 'use_domain_pool' => 'setUseDomainPool', + 'tags' => 'setTags', + 'expires_at' => 'setExpiresAt', + 'favourite' => 'setFavourite', + 'expires_in' => 'setExpiresIn', + 'allow_team_access' => 'setAllowTeamAccess', + 'inbox_type' => 'setInboxType', + 'virtual_inbox' => 'setVirtualInbox', + 'use_short_address' => 'setUseShortAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_address' => 'getEmailAddress', + 'name' => 'getName', + 'description' => 'getDescription', + 'use_domain_pool' => 'getUseDomainPool', + 'tags' => 'getTags', + 'expires_at' => 'getExpiresAt', + 'favourite' => 'getFavourite', + 'expires_in' => 'getExpiresIn', + 'allow_team_access' => 'getAllowTeamAccess', + 'inbox_type' => 'getInboxType', + 'virtual_inbox' => 'getVirtualInbox', + 'use_short_address' => 'getUseShortAddress' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInboxTypeAllowableValues() + { + return [ + self::INBOX_TYPE_HTTP_INBOX, + self::INBOX_TYPE_SMTP_INBOX, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('use_domain_pool', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('favourite', $data ?? [], null); + $this->setIfExists('expires_in', $data ?? [], null); + $this->setIfExists('allow_team_access', $data ?? [], null); + $this->setIfExists('inbox_type', $data ?? [], null); + $this->setIfExists('virtual_inbox', $data ?? [], null); + $this->setIfExists('use_short_address', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'inbox_type', must be one of '%s'", + $this->container['inbox_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_address + * + * @return string|null + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string|null $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + array_push($this->openAPINullablesSetToNull, 'email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets use_domain_pool + * + * @return bool|null + */ + public function getUseDomainPool() + { + return $this->container['use_domain_pool']; + } + + /** + * Sets use_domain_pool + * + * @param bool|null $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. + * + * @return self + */ + public function setUseDomainPool($use_domain_pool) + { + + if (is_null($use_domain_pool)) { + array_push($this->openAPINullablesSetToNull, 'use_domain_pool'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_domain_pool', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_domain_pool'] = $use_domain_pool; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets favourite + * + * @return bool|null + */ + public function getFavourite() + { + return $this->container['favourite']; + } + + /** + * Sets favourite + * + * @param bool|null $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setFavourite($favourite) + { + + if (is_null($favourite)) { + array_push($this->openAPINullablesSetToNull, 'favourite'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('favourite', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['favourite'] = $favourite; + + return $this; + } + + /** + * Gets expires_in + * + * @return int|null + */ + public function getExpiresIn() + { + return $this->container['expires_in']; + } + + /** + * Sets expires_in + * + * @param int|null $expires_in Number of milliseconds that inbox should exist for + * + * @return self + */ + public function setExpiresIn($expires_in) + { + + if (is_null($expires_in)) { + array_push($this->openAPINullablesSetToNull, 'expires_in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['expires_in'] = $expires_in; + + return $this; + } + + /** + * Gets allow_team_access + * + * @return bool|null + */ + public function getAllowTeamAccess() + { + return $this->container['allow_team_access']; + } + + /** + * Sets allow_team_access + * + * @param bool|null $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. + * + * @return self + */ + public function setAllowTeamAccess($allow_team_access) + { + + if (is_null($allow_team_access)) { + array_push($this->openAPINullablesSetToNull, 'allow_team_access'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('allow_team_access', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['allow_team_access'] = $allow_team_access; + + return $this; + } + + /** + * Gets inbox_type + * + * @return string|null + */ + public function getInboxType() + { + return $this->container['inbox_type']; + } + + /** + * Sets inbox_type + * + * @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). + * + * @return self + */ + public function setInboxType($inbox_type) + { + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'inbox_type', must be one of '%s'", + $inbox_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($inbox_type)) { + array_push($this->openAPINullablesSetToNull, 'inbox_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_type'] = $inbox_type; + + return $this; + } + + /** + * Gets virtual_inbox + * + * @return bool|null + */ + public function getVirtualInbox() + { + return $this->container['virtual_inbox']; + } + + /** + * Sets virtual_inbox + * + * @param bool|null $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. + * + * @return self + */ + public function setVirtualInbox($virtual_inbox) + { + + if (is_null($virtual_inbox)) { + array_push($this->openAPINullablesSetToNull, 'virtual_inbox'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virtual_inbox', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['virtual_inbox'] = $virtual_inbox; + + return $this; + } + + /** + * Gets use_short_address + * + * @return bool|null + */ + public function getUseShortAddress() + { + return $this->container['use_short_address']; + } + + /** + * Sets use_short_address + * + * @param bool|null $use_short_address Use a shorter email address under 31 characters + * + * @return self + */ + public function setUseShortAddress($use_short_address) + { + + if (is_null($use_short_address)) { + array_push($this->openAPINullablesSetToNull, 'use_short_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_short_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_short_address'] = $use_short_address; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateInboxForwarderOptions.php b/lib/Models/CreateInboxForwarderOptions.php new file mode 100644 index 00000000..8dd2a448 --- /dev/null +++ b/lib/Models/CreateInboxForwarderOptions.php @@ -0,0 +1,532 @@ + + */ +class CreateInboxForwarderOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateInboxForwarderOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'field' => 'string', + 'match' => 'string', + 'forward_to_recipients' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field' => null, + 'match' => null, + 'forward_to_recipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'field' => false, + 'match' => false, + 'forward_to_recipients' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'field' => 'field', + 'match' => 'match', + 'forward_to_recipients' => 'forwardToRecipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field' => 'setField', + 'match' => 'setMatch', + 'forward_to_recipients' => 'setForwardToRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field' => 'getField', + 'match' => 'getMatch', + 'forward_to_recipients' => 'getForwardToRecipients' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const FIELD_RECIPIENTS = 'RECIPIENTS'; + public const FIELD_SENDER = 'SENDER'; + public const FIELD_SUBJECT = 'SUBJECT'; + public const FIELD_ATTACHMENTS = 'ATTACHMENTS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldAllowableValues() + { + return [ + self::FIELD_RECIPIENTS, + self::FIELD_SENDER, + self::FIELD_SUBJECT, + self::FIELD_ATTACHMENTS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('match', $data ?? [], null); + $this->setIfExists('forward_to_recipients', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['field'] === null) { + $invalidProperties[] = "'field' can't be null"; + } + $allowedValues = $this->getFieldAllowableValues(); + if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field', must be one of '%s'", + $this->container['field'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['match'] === null) { + $invalidProperties[] = "'match' can't be null"; + } + if ($this->container['forward_to_recipients'] === null) { + $invalidProperties[] = "'forward_to_recipients' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets field + * + * @return string + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string $field Field to match against to trigger inbox forwarding for inbound email + * + * @return self + */ + public function setField($field) + { + $allowedValues = $this->getFieldAllowableValues(); + if (!in_array($field, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field', must be one of '%s'", + $field, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets match + * + * @return string + */ + public function getMatch() + { + return $this->container['match']; + } + + /** + * Sets match + * + * @param string $match String or wildcard style match for field specified when evaluating forwarding rules + * + * @return self + */ + public function setMatch($match) + { + + if (is_null($match)) { + throw new \InvalidArgumentException('non-nullable match cannot be null'); + } + + $this->container['match'] = $match; + + return $this; + } + + /** + * Gets forward_to_recipients + * + * @return string[] + */ + public function getForwardToRecipients() + { + return $this->container['forward_to_recipients']; + } + + /** + * Sets forward_to_recipients + * + * @param string[] $forward_to_recipients Email addresses to forward an email to if it matches the field and match criteria of the forwarder + * + * @return self + */ + public function setForwardToRecipients($forward_to_recipients) + { + + if (is_null($forward_to_recipients)) { + throw new \InvalidArgumentException('non-nullable forward_to_recipients cannot be null'); + } + + $this->container['forward_to_recipients'] = $forward_to_recipients; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateInboxRulesetOptions.php b/lib/Models/CreateInboxRulesetOptions.php new file mode 100644 index 00000000..ebf8da52 --- /dev/null +++ b/lib/Models/CreateInboxRulesetOptions.php @@ -0,0 +1,564 @@ + + */ +class CreateInboxRulesetOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateInboxRulesetOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'scope' => 'string', + 'action' => 'string', + 'target' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'scope' => null, + 'action' => null, + 'target' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'scope' => false, + 'action' => false, + 'target' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'scope' => 'scope', + 'action' => 'action', + 'target' => 'target' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'scope' => 'setScope', + 'action' => 'setAction', + 'target' => 'setTarget' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'scope' => 'getScope', + 'action' => 'getAction', + 'target' => 'getTarget' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SCOPE_RECEIVING_EMAILS = 'RECEIVING_EMAILS'; + public const SCOPE_SENDING_EMAILS = 'SENDING_EMAILS'; + public const ACTION_BLOCK = 'BLOCK'; + public const ACTION_ALLOW = 'ALLOW'; + public const ACTION_FILTER_REMOVE = 'FILTER_REMOVE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getScopeAllowableValues() + { + return [ + self::SCOPE_RECEIVING_EMAILS, + self::SCOPE_SENDING_EMAILS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getActionAllowableValues() + { + return [ + self::ACTION_BLOCK, + self::ACTION_ALLOW, + self::ACTION_FILTER_REMOVE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('target', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['scope'] === null) { + $invalidProperties[] = "'scope' can't be null"; + } + $allowedValues = $this->getScopeAllowableValues(); + if (!is_null($this->container['scope']) && !in_array($this->container['scope'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'scope', must be one of '%s'", + $this->container['scope'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['action'] === null) { + $invalidProperties[] = "'action' can't be null"; + } + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'action', must be one of '%s'", + $this->container['action'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['target'] === null) { + $invalidProperties[] = "'target' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets scope + * + * @return string + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string $scope What type of emails actions to apply ruleset to. Either `SENDING_EMAILS` or `RECEIVING_EMAILS` will apply action and target to any sending or receiving of emails respectively. + * + * @return self + */ + public function setScope($scope) + { + $allowedValues = $this->getScopeAllowableValues(); + if (!in_array($scope, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'scope', must be one of '%s'", + $scope, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($scope)) { + throw new \InvalidArgumentException('non-nullable scope cannot be null'); + } + + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets action + * + * @return string + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string $action Action to be taken when the ruleset matches an email for the given scope. For example: `BLOCK` action with target `*` and scope `SENDING_EMAILS` blocks sending to all recipients. Note `ALLOW` takes precedent over `BLOCK`. `FILTER_REMOVE` is like block but will remove offending email addresses during a send or receive event instead of blocking the action. + * + * @return self + */ + public function setAction($action) + { + $allowedValues = $this->getActionAllowableValues(); + if (!in_array($action, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'action', must be one of '%s'", + $action, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets target + * + * @return string + */ + public function getTarget() + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param string $target Target to match emails with. Can be a wild-card type pattern or a valid email address. For instance `*@gmail.com` matches all gmail addresses while `test@gmail.com` matches one address exactly. The target is applied to every recipient field email address when `SENDING_EMAILS` is the scope and is applied to sender of email when `RECEIVING_EMAILS`. + * + * @return self + */ + public function setTarget($target) + { + + if (is_null($target)) { + throw new \InvalidArgumentException('non-nullable target cannot be null'); + } + + $this->container['target'] = $target; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateTemplateOptions.php b/lib/Models/CreateTemplateOptions.php new file mode 100644 index 00000000..e0b5edf9 --- /dev/null +++ b/lib/Models/CreateTemplateOptions.php @@ -0,0 +1,455 @@ + + */ +class CreateTemplateOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateTemplateOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'content' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'content' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'content' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'content' => 'getContent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of template + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets content + * + * @return string + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string $content Template content. Can include moustache style variables such as {{var_name}} + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateTrackingPixelOptions.php b/lib/Models/CreateTrackingPixelOptions.php new file mode 100644 index 00000000..2b2f84b8 --- /dev/null +++ b/lib/Models/CreateTrackingPixelOptions.php @@ -0,0 +1,463 @@ + + */ +class CreateTrackingPixelOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateTrackingPixelOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'recipient' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'recipient' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'recipient' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'recipient' => 'recipient' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'recipient' => 'setRecipient' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'recipient' => 'getRecipient' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets recipient + * + * @return string|null + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string|null $recipient recipient + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + array_push($this->openAPINullablesSetToNull, 'recipient'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recipient', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['recipient'] = $recipient; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/CreateWebhookOptions.php b/lib/Models/CreateWebhookOptions.php new file mode 100644 index 00000000..5a77dbc3 --- /dev/null +++ b/lib/Models/CreateWebhookOptions.php @@ -0,0 +1,674 @@ + + */ +class CreateWebhookOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateWebhookOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string', + 'basic_auth' => '\MailSlurp\Models\BasicAuthOptions', + 'name' => 'string', + 'event_name' => 'string', + 'include_headers' => '\MailSlurp\Models\WebhookHeaders', + 'request_body_template' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null, + 'basic_auth' => null, + 'name' => null, + 'event_name' => null, + 'include_headers' => null, + 'request_body_template' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => false, + 'basic_auth' => true, + 'name' => true, + 'event_name' => true, + 'include_headers' => false, + 'request_body_template' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'url' => 'url', + 'basic_auth' => 'basicAuth', + 'name' => 'name', + 'event_name' => 'eventName', + 'include_headers' => 'includeHeaders', + 'request_body_template' => 'requestBodyTemplate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl', + 'basic_auth' => 'setBasicAuth', + 'name' => 'setName', + 'event_name' => 'setEventName', + 'include_headers' => 'setIncludeHeaders', + 'request_body_template' => 'setRequestBodyTemplate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl', + 'basic_auth' => 'getBasicAuth', + 'name' => 'getName', + 'event_name' => 'getEventName', + 'include_headers' => 'getIncludeHeaders', + 'request_body_template' => 'getRequestBodyTemplate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('include_headers', $data ?? [], null); + $this->setIfExists('request_body_template', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url Public URL on your server that MailSlurp can post WebhookNotification payload to when an email is received or an event is trigger. The payload of the submitted JSON is dependent on the webhook event type. See docs.mailslurp.com/webhooks for event payload documentation. + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets basic_auth + * + * @return \MailSlurp\Models\BasicAuthOptions|null + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param \MailSlurp\Models\BasicAuthOptions|null $basic_auth basic_auth + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + + if (is_null($basic_auth)) { + array_push($this->openAPINullablesSetToNull, 'basic_auth'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('basic_auth', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Optional name for the webhook + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + array_push($this->openAPINullablesSetToNull, 'event_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets include_headers + * + * @return \MailSlurp\Models\WebhookHeaders|null + */ + public function getIncludeHeaders() + { + return $this->container['include_headers']; + } + + /** + * Sets include_headers + * + * @param \MailSlurp\Models\WebhookHeaders|null $include_headers include_headers + * + * @return self + */ + public function setIncludeHeaders($include_headers) + { + + if (is_null($include_headers)) { + throw new \InvalidArgumentException('non-nullable include_headers cannot be null'); + } + + $this->container['include_headers'] = $include_headers; + + return $this; + } + + /** + * Gets request_body_template + * + * @return string|null + */ + public function getRequestBodyTemplate() + { + return $this->container['request_body_template']; + } + + /** + * Sets request_body_template + * + * @param string|null $request_body_template Template for the JSON body of the webhook request that will be sent to your server. Use Moustache style `{{variableName}}` templating to use parts of the standard webhook payload for the given event. + * + * @return self + */ + public function setRequestBodyTemplate($request_body_template) + { + + if (is_null($request_body_template)) { + array_push($this->openAPINullablesSetToNull, 'request_body_template'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('request_body_template', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['request_body_template'] = $request_body_template; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DNSLookupOptions.php b/lib/Models/DNSLookupOptions.php new file mode 100644 index 00000000..0212d894 --- /dev/null +++ b/lib/Models/DNSLookupOptions.php @@ -0,0 +1,692 @@ + + */ +class DNSLookupOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DNSLookupOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hostname' => 'string', + 'record_types' => 'string[]', + 'omit_final_dns_dot' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hostname' => null, + 'record_types' => null, + 'omit_final_dns_dot' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hostname' => false, + 'record_types' => false, + 'omit_final_dns_dot' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hostname' => 'hostname', + 'record_types' => 'recordTypes', + 'omit_final_dns_dot' => 'omitFinalDNSDot' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hostname' => 'setHostname', + 'record_types' => 'setRecordTypes', + 'omit_final_dns_dot' => 'setOmitFinalDnsDot' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hostname' => 'getHostname', + 'record_types' => 'getRecordTypes', + 'omit_final_dns_dot' => 'getOmitFinalDnsDot' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const RECORD_TYPES_A = 'A'; + public const RECORD_TYPES_NS = 'NS'; + public const RECORD_TYPES_MD = 'MD'; + public const RECORD_TYPES_MF = 'MF'; + public const RECORD_TYPES_CNAME = 'CNAME'; + public const RECORD_TYPES_SOA = 'SOA'; + public const RECORD_TYPES_MB = 'MB'; + public const RECORD_TYPES_MG = 'MG'; + public const RECORD_TYPES_MR = 'MR'; + public const RECORD_TYPES_NULL = 'NULL'; + public const RECORD_TYPES_WKS = 'WKS'; + public const RECORD_TYPES_PTR = 'PTR'; + public const RECORD_TYPES_HINFO = 'HINFO'; + public const RECORD_TYPES_MINFO = 'MINFO'; + public const RECORD_TYPES_MX = 'MX'; + public const RECORD_TYPES_TXT = 'TXT'; + public const RECORD_TYPES_RP = 'RP'; + public const RECORD_TYPES_AFSDB = 'AFSDB'; + public const RECORD_TYPES_X25 = 'X25'; + public const RECORD_TYPES_ISDN = 'ISDN'; + public const RECORD_TYPES_RT = 'RT'; + public const RECORD_TYPES_NSAP = 'NSAP'; + public const RECORD_TYPES_NSAP_PTR = 'NSAP_PTR'; + public const RECORD_TYPES_SIG = 'SIG'; + public const RECORD_TYPES_KEY = 'KEY'; + public const RECORD_TYPES_PX = 'PX'; + public const RECORD_TYPES_GPOS = 'GPOS'; + public const RECORD_TYPES_AAAA = 'AAAA'; + public const RECORD_TYPES_LOC = 'LOC'; + public const RECORD_TYPES_NXT = 'NXT'; + public const RECORD_TYPES_EID = 'EID'; + public const RECORD_TYPES_NIMLOC = 'NIMLOC'; + public const RECORD_TYPES_SRV = 'SRV'; + public const RECORD_TYPES_ATMA = 'ATMA'; + public const RECORD_TYPES_NAPTR = 'NAPTR'; + public const RECORD_TYPES_KX = 'KX'; + public const RECORD_TYPES_CERT = 'CERT'; + public const RECORD_TYPES_A6 = 'A6'; + public const RECORD_TYPES_DNAME = 'DNAME'; + public const RECORD_TYPES_SINK = 'SINK'; + public const RECORD_TYPES_OPT = 'OPT'; + public const RECORD_TYPES_APL = 'APL'; + public const RECORD_TYPES_DS = 'DS'; + public const RECORD_TYPES_SSHFP = 'SSHFP'; + public const RECORD_TYPES_IPSECKEY = 'IPSECKEY'; + public const RECORD_TYPES_RRSIG = 'RRSIG'; + public const RECORD_TYPES_NSEC = 'NSEC'; + public const RECORD_TYPES_DNSKEY = 'DNSKEY'; + public const RECORD_TYPES_DHCID = 'DHCID'; + public const RECORD_TYPES_NSEC3 = 'NSEC3'; + public const RECORD_TYPES_NSEC3_PARAM = 'NSEC3PARAM'; + public const RECORD_TYPES_TLSA = 'TLSA'; + public const RECORD_TYPES_SMIMEA = 'SMIMEA'; + public const RECORD_TYPES_HIP = 'HIP'; + public const RECORD_TYPES_NINFO = 'NINFO'; + public const RECORD_TYPES_RKEY = 'RKEY'; + public const RECORD_TYPES_TALINK = 'TALINK'; + public const RECORD_TYPES_CDS = 'CDS'; + public const RECORD_TYPES_CDNSKEY = 'CDNSKEY'; + public const RECORD_TYPES_OPENPGPKEY = 'OPENPGPKEY'; + public const RECORD_TYPES_CSYNC = 'CSYNC'; + public const RECORD_TYPES_ZONEMD = 'ZONEMD'; + public const RECORD_TYPES_SVCB = 'SVCB'; + public const RECORD_TYPES_HTTPS = 'HTTPS'; + public const RECORD_TYPES_SPF = 'SPF'; + public const RECORD_TYPES_UINFO = 'UINFO'; + public const RECORD_TYPES_UID = 'UID'; + public const RECORD_TYPES_GID = 'GID'; + public const RECORD_TYPES_UNSPEC = 'UNSPEC'; + public const RECORD_TYPES_NID = 'NID'; + public const RECORD_TYPES_L32 = 'L32'; + public const RECORD_TYPES_L64 = 'L64'; + public const RECORD_TYPES_LP = 'LP'; + public const RECORD_TYPES_EUI48 = 'EUI48'; + public const RECORD_TYPES_EUI64 = 'EUI64'; + public const RECORD_TYPES_TKEY = 'TKEY'; + public const RECORD_TYPES_TSIG = 'TSIG'; + public const RECORD_TYPES_IXFR = 'IXFR'; + public const RECORD_TYPES_AXFR = 'AXFR'; + public const RECORD_TYPES_MAILB = 'MAILB'; + public const RECORD_TYPES_MAILA = 'MAILA'; + public const RECORD_TYPES_ANY = 'ANY'; + public const RECORD_TYPES_URI = 'URI'; + public const RECORD_TYPES_CAA = 'CAA'; + public const RECORD_TYPES_AVC = 'AVC'; + public const RECORD_TYPES_DOA = 'DOA'; + public const RECORD_TYPES_AMTRELAY = 'AMTRELAY'; + public const RECORD_TYPES_TA = 'TA'; + public const RECORD_TYPES_DLV = 'DLV'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRecordTypesAllowableValues() + { + return [ + self::RECORD_TYPES_A, + self::RECORD_TYPES_NS, + self::RECORD_TYPES_MD, + self::RECORD_TYPES_MF, + self::RECORD_TYPES_CNAME, + self::RECORD_TYPES_SOA, + self::RECORD_TYPES_MB, + self::RECORD_TYPES_MG, + self::RECORD_TYPES_MR, + self::RECORD_TYPES_NULL, + self::RECORD_TYPES_WKS, + self::RECORD_TYPES_PTR, + self::RECORD_TYPES_HINFO, + self::RECORD_TYPES_MINFO, + self::RECORD_TYPES_MX, + self::RECORD_TYPES_TXT, + self::RECORD_TYPES_RP, + self::RECORD_TYPES_AFSDB, + self::RECORD_TYPES_X25, + self::RECORD_TYPES_ISDN, + self::RECORD_TYPES_RT, + self::RECORD_TYPES_NSAP, + self::RECORD_TYPES_NSAP_PTR, + self::RECORD_TYPES_SIG, + self::RECORD_TYPES_KEY, + self::RECORD_TYPES_PX, + self::RECORD_TYPES_GPOS, + self::RECORD_TYPES_AAAA, + self::RECORD_TYPES_LOC, + self::RECORD_TYPES_NXT, + self::RECORD_TYPES_EID, + self::RECORD_TYPES_NIMLOC, + self::RECORD_TYPES_SRV, + self::RECORD_TYPES_ATMA, + self::RECORD_TYPES_NAPTR, + self::RECORD_TYPES_KX, + self::RECORD_TYPES_CERT, + self::RECORD_TYPES_A6, + self::RECORD_TYPES_DNAME, + self::RECORD_TYPES_SINK, + self::RECORD_TYPES_OPT, + self::RECORD_TYPES_APL, + self::RECORD_TYPES_DS, + self::RECORD_TYPES_SSHFP, + self::RECORD_TYPES_IPSECKEY, + self::RECORD_TYPES_RRSIG, + self::RECORD_TYPES_NSEC, + self::RECORD_TYPES_DNSKEY, + self::RECORD_TYPES_DHCID, + self::RECORD_TYPES_NSEC3, + self::RECORD_TYPES_NSEC3_PARAM, + self::RECORD_TYPES_TLSA, + self::RECORD_TYPES_SMIMEA, + self::RECORD_TYPES_HIP, + self::RECORD_TYPES_NINFO, + self::RECORD_TYPES_RKEY, + self::RECORD_TYPES_TALINK, + self::RECORD_TYPES_CDS, + self::RECORD_TYPES_CDNSKEY, + self::RECORD_TYPES_OPENPGPKEY, + self::RECORD_TYPES_CSYNC, + self::RECORD_TYPES_ZONEMD, + self::RECORD_TYPES_SVCB, + self::RECORD_TYPES_HTTPS, + self::RECORD_TYPES_SPF, + self::RECORD_TYPES_UINFO, + self::RECORD_TYPES_UID, + self::RECORD_TYPES_GID, + self::RECORD_TYPES_UNSPEC, + self::RECORD_TYPES_NID, + self::RECORD_TYPES_L32, + self::RECORD_TYPES_L64, + self::RECORD_TYPES_LP, + self::RECORD_TYPES_EUI48, + self::RECORD_TYPES_EUI64, + self::RECORD_TYPES_TKEY, + self::RECORD_TYPES_TSIG, + self::RECORD_TYPES_IXFR, + self::RECORD_TYPES_AXFR, + self::RECORD_TYPES_MAILB, + self::RECORD_TYPES_MAILA, + self::RECORD_TYPES_ANY, + self::RECORD_TYPES_URI, + self::RECORD_TYPES_CAA, + self::RECORD_TYPES_AVC, + self::RECORD_TYPES_DOA, + self::RECORD_TYPES_AMTRELAY, + self::RECORD_TYPES_TA, + self::RECORD_TYPES_DLV, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('hostname', $data ?? [], null); + $this->setIfExists('record_types', $data ?? [], null); + $this->setIfExists('omit_final_dns_dot', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['hostname'] === null) { + $invalidProperties[] = "'hostname' can't be null"; + } + if ($this->container['record_types'] === null) { + $invalidProperties[] = "'record_types' can't be null"; + } + if ($this->container['omit_final_dns_dot'] === null) { + $invalidProperties[] = "'omit_final_dns_dot' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets hostname + * + * @return string + */ + public function getHostname() + { + return $this->container['hostname']; + } + + /** + * Sets hostname + * + * @param string $hostname List of record types you wish to query such as MX, DNS, TXT, NS, A etc. + * + * @return self + */ + public function setHostname($hostname) + { + + if (is_null($hostname)) { + throw new \InvalidArgumentException('non-nullable hostname cannot be null'); + } + + $this->container['hostname'] = $hostname; + + return $this; + } + + /** + * Gets record_types + * + * @return string[] + */ + public function getRecordTypes() + { + return $this->container['record_types']; + } + + /** + * Sets record_types + * + * @param string[] $record_types List of record types you wish to query such as MX, DNS, TXT, NS, A etc. + * + * @return self + */ + public function setRecordTypes($record_types) + { + $allowedValues = $this->getRecordTypesAllowableValues(); + if (array_diff($record_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'record_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($record_types)) { + throw new \InvalidArgumentException('non-nullable record_types cannot be null'); + } + + $this->container['record_types'] = $record_types; + + return $this; + } + + /** + * Gets omit_final_dns_dot + * + * @return bool + */ + public function getOmitFinalDnsDot() + { + return $this->container['omit_final_dns_dot']; + } + + /** + * Sets omit_final_dns_dot + * + * @param bool $omit_final_dns_dot Optionally control whether to omit the final dot in full DNS name values. + * + * @return self + */ + public function setOmitFinalDnsDot($omit_final_dns_dot) + { + + if (is_null($omit_final_dns_dot)) { + throw new \InvalidArgumentException('non-nullable omit_final_dns_dot cannot be null'); + } + + $this->container['omit_final_dns_dot'] = $omit_final_dns_dot; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DNSLookupResult.php b/lib/Models/DNSLookupResult.php new file mode 100644 index 00000000..a72edfda --- /dev/null +++ b/lib/Models/DNSLookupResult.php @@ -0,0 +1,741 @@ + + */ +class DNSLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DNSLookupResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'record_type' => 'string', + 'ttl' => 'int', + 'record_entries' => 'string[]', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'record_type' => null, + 'ttl' => 'int64', + 'record_entries' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'record_type' => false, + 'ttl' => false, + 'record_entries' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'record_type' => 'recordType', + 'ttl' => 'ttl', + 'record_entries' => 'recordEntries', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'record_type' => 'setRecordType', + 'ttl' => 'setTtl', + 'record_entries' => 'setRecordEntries', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'record_type' => 'getRecordType', + 'ttl' => 'getTtl', + 'record_entries' => 'getRecordEntries', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const RECORD_TYPE_A = 'A'; + public const RECORD_TYPE_NS = 'NS'; + public const RECORD_TYPE_MD = 'MD'; + public const RECORD_TYPE_MF = 'MF'; + public const RECORD_TYPE_CNAME = 'CNAME'; + public const RECORD_TYPE_SOA = 'SOA'; + public const RECORD_TYPE_MB = 'MB'; + public const RECORD_TYPE_MG = 'MG'; + public const RECORD_TYPE_MR = 'MR'; + public const RECORD_TYPE_NULL = 'NULL'; + public const RECORD_TYPE_WKS = 'WKS'; + public const RECORD_TYPE_PTR = 'PTR'; + public const RECORD_TYPE_HINFO = 'HINFO'; + public const RECORD_TYPE_MINFO = 'MINFO'; + public const RECORD_TYPE_MX = 'MX'; + public const RECORD_TYPE_TXT = 'TXT'; + public const RECORD_TYPE_RP = 'RP'; + public const RECORD_TYPE_AFSDB = 'AFSDB'; + public const RECORD_TYPE_X25 = 'X25'; + public const RECORD_TYPE_ISDN = 'ISDN'; + public const RECORD_TYPE_RT = 'RT'; + public const RECORD_TYPE_NSAP = 'NSAP'; + public const RECORD_TYPE_NSAP_PTR = 'NSAP_PTR'; + public const RECORD_TYPE_SIG = 'SIG'; + public const RECORD_TYPE_KEY = 'KEY'; + public const RECORD_TYPE_PX = 'PX'; + public const RECORD_TYPE_GPOS = 'GPOS'; + public const RECORD_TYPE_AAAA = 'AAAA'; + public const RECORD_TYPE_LOC = 'LOC'; + public const RECORD_TYPE_NXT = 'NXT'; + public const RECORD_TYPE_EID = 'EID'; + public const RECORD_TYPE_NIMLOC = 'NIMLOC'; + public const RECORD_TYPE_SRV = 'SRV'; + public const RECORD_TYPE_ATMA = 'ATMA'; + public const RECORD_TYPE_NAPTR = 'NAPTR'; + public const RECORD_TYPE_KX = 'KX'; + public const RECORD_TYPE_CERT = 'CERT'; + public const RECORD_TYPE_A6 = 'A6'; + public const RECORD_TYPE_DNAME = 'DNAME'; + public const RECORD_TYPE_SINK = 'SINK'; + public const RECORD_TYPE_OPT = 'OPT'; + public const RECORD_TYPE_APL = 'APL'; + public const RECORD_TYPE_DS = 'DS'; + public const RECORD_TYPE_SSHFP = 'SSHFP'; + public const RECORD_TYPE_IPSECKEY = 'IPSECKEY'; + public const RECORD_TYPE_RRSIG = 'RRSIG'; + public const RECORD_TYPE_NSEC = 'NSEC'; + public const RECORD_TYPE_DNSKEY = 'DNSKEY'; + public const RECORD_TYPE_DHCID = 'DHCID'; + public const RECORD_TYPE_NSEC3 = 'NSEC3'; + public const RECORD_TYPE_NSEC3_PARAM = 'NSEC3PARAM'; + public const RECORD_TYPE_TLSA = 'TLSA'; + public const RECORD_TYPE_SMIMEA = 'SMIMEA'; + public const RECORD_TYPE_HIP = 'HIP'; + public const RECORD_TYPE_NINFO = 'NINFO'; + public const RECORD_TYPE_RKEY = 'RKEY'; + public const RECORD_TYPE_TALINK = 'TALINK'; + public const RECORD_TYPE_CDS = 'CDS'; + public const RECORD_TYPE_CDNSKEY = 'CDNSKEY'; + public const RECORD_TYPE_OPENPGPKEY = 'OPENPGPKEY'; + public const RECORD_TYPE_CSYNC = 'CSYNC'; + public const RECORD_TYPE_ZONEMD = 'ZONEMD'; + public const RECORD_TYPE_SVCB = 'SVCB'; + public const RECORD_TYPE_HTTPS = 'HTTPS'; + public const RECORD_TYPE_SPF = 'SPF'; + public const RECORD_TYPE_UINFO = 'UINFO'; + public const RECORD_TYPE_UID = 'UID'; + public const RECORD_TYPE_GID = 'GID'; + public const RECORD_TYPE_UNSPEC = 'UNSPEC'; + public const RECORD_TYPE_NID = 'NID'; + public const RECORD_TYPE_L32 = 'L32'; + public const RECORD_TYPE_L64 = 'L64'; + public const RECORD_TYPE_LP = 'LP'; + public const RECORD_TYPE_EUI48 = 'EUI48'; + public const RECORD_TYPE_EUI64 = 'EUI64'; + public const RECORD_TYPE_TKEY = 'TKEY'; + public const RECORD_TYPE_TSIG = 'TSIG'; + public const RECORD_TYPE_IXFR = 'IXFR'; + public const RECORD_TYPE_AXFR = 'AXFR'; + public const RECORD_TYPE_MAILB = 'MAILB'; + public const RECORD_TYPE_MAILA = 'MAILA'; + public const RECORD_TYPE_ANY = 'ANY'; + public const RECORD_TYPE_URI = 'URI'; + public const RECORD_TYPE_CAA = 'CAA'; + public const RECORD_TYPE_AVC = 'AVC'; + public const RECORD_TYPE_DOA = 'DOA'; + public const RECORD_TYPE_AMTRELAY = 'AMTRELAY'; + public const RECORD_TYPE_TA = 'TA'; + public const RECORD_TYPE_DLV = 'DLV'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRecordTypeAllowableValues() + { + return [ + self::RECORD_TYPE_A, + self::RECORD_TYPE_NS, + self::RECORD_TYPE_MD, + self::RECORD_TYPE_MF, + self::RECORD_TYPE_CNAME, + self::RECORD_TYPE_SOA, + self::RECORD_TYPE_MB, + self::RECORD_TYPE_MG, + self::RECORD_TYPE_MR, + self::RECORD_TYPE_NULL, + self::RECORD_TYPE_WKS, + self::RECORD_TYPE_PTR, + self::RECORD_TYPE_HINFO, + self::RECORD_TYPE_MINFO, + self::RECORD_TYPE_MX, + self::RECORD_TYPE_TXT, + self::RECORD_TYPE_RP, + self::RECORD_TYPE_AFSDB, + self::RECORD_TYPE_X25, + self::RECORD_TYPE_ISDN, + self::RECORD_TYPE_RT, + self::RECORD_TYPE_NSAP, + self::RECORD_TYPE_NSAP_PTR, + self::RECORD_TYPE_SIG, + self::RECORD_TYPE_KEY, + self::RECORD_TYPE_PX, + self::RECORD_TYPE_GPOS, + self::RECORD_TYPE_AAAA, + self::RECORD_TYPE_LOC, + self::RECORD_TYPE_NXT, + self::RECORD_TYPE_EID, + self::RECORD_TYPE_NIMLOC, + self::RECORD_TYPE_SRV, + self::RECORD_TYPE_ATMA, + self::RECORD_TYPE_NAPTR, + self::RECORD_TYPE_KX, + self::RECORD_TYPE_CERT, + self::RECORD_TYPE_A6, + self::RECORD_TYPE_DNAME, + self::RECORD_TYPE_SINK, + self::RECORD_TYPE_OPT, + self::RECORD_TYPE_APL, + self::RECORD_TYPE_DS, + self::RECORD_TYPE_SSHFP, + self::RECORD_TYPE_IPSECKEY, + self::RECORD_TYPE_RRSIG, + self::RECORD_TYPE_NSEC, + self::RECORD_TYPE_DNSKEY, + self::RECORD_TYPE_DHCID, + self::RECORD_TYPE_NSEC3, + self::RECORD_TYPE_NSEC3_PARAM, + self::RECORD_TYPE_TLSA, + self::RECORD_TYPE_SMIMEA, + self::RECORD_TYPE_HIP, + self::RECORD_TYPE_NINFO, + self::RECORD_TYPE_RKEY, + self::RECORD_TYPE_TALINK, + self::RECORD_TYPE_CDS, + self::RECORD_TYPE_CDNSKEY, + self::RECORD_TYPE_OPENPGPKEY, + self::RECORD_TYPE_CSYNC, + self::RECORD_TYPE_ZONEMD, + self::RECORD_TYPE_SVCB, + self::RECORD_TYPE_HTTPS, + self::RECORD_TYPE_SPF, + self::RECORD_TYPE_UINFO, + self::RECORD_TYPE_UID, + self::RECORD_TYPE_GID, + self::RECORD_TYPE_UNSPEC, + self::RECORD_TYPE_NID, + self::RECORD_TYPE_L32, + self::RECORD_TYPE_L64, + self::RECORD_TYPE_LP, + self::RECORD_TYPE_EUI48, + self::RECORD_TYPE_EUI64, + self::RECORD_TYPE_TKEY, + self::RECORD_TYPE_TSIG, + self::RECORD_TYPE_IXFR, + self::RECORD_TYPE_AXFR, + self::RECORD_TYPE_MAILB, + self::RECORD_TYPE_MAILA, + self::RECORD_TYPE_ANY, + self::RECORD_TYPE_URI, + self::RECORD_TYPE_CAA, + self::RECORD_TYPE_AVC, + self::RECORD_TYPE_DOA, + self::RECORD_TYPE_AMTRELAY, + self::RECORD_TYPE_TA, + self::RECORD_TYPE_DLV, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('record_type', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('record_entries', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['record_type'] === null) { + $invalidProperties[] = "'record_type' can't be null"; + } + $allowedValues = $this->getRecordTypeAllowableValues(); + if (!is_null($this->container['record_type']) && !in_array($this->container['record_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'record_type', must be one of '%s'", + $this->container['record_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['ttl'] === null) { + $invalidProperties[] = "'ttl' can't be null"; + } + if ($this->container['record_entries'] === null) { + $invalidProperties[] = "'record_entries' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets record_type + * + * @return string + */ + public function getRecordType() + { + return $this->container['record_type']; + } + + /** + * Sets record_type + * + * @param string $record_type Domain Name Server Record Types + * + * @return self + */ + public function setRecordType($record_type) + { + $allowedValues = $this->getRecordTypeAllowableValues(); + if (!in_array($record_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'record_type', must be one of '%s'", + $record_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($record_type)) { + throw new \InvalidArgumentException('non-nullable record_type cannot be null'); + } + + $this->container['record_type'] = $record_type; + + return $this; + } + + /** + * Gets ttl + * + * @return int + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int $ttl ttl + * + * @return self + */ + public function setTtl($ttl) + { + + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets record_entries + * + * @return string[] + */ + public function getRecordEntries() + { + return $this->container['record_entries']; + } + + /** + * Sets record_entries + * + * @param string[] $record_entries record_entries + * + * @return self + */ + public function setRecordEntries($record_entries) + { + + if (is_null($record_entries)) { + throw new \InvalidArgumentException('non-nullable record_entries cannot be null'); + } + + $this->container['record_entries'] = $record_entries; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DNSLookupResults.php b/lib/Models/DNSLookupResults.php new file mode 100644 index 00000000..998dfefa --- /dev/null +++ b/lib/Models/DNSLookupResults.php @@ -0,0 +1,416 @@ + + */ +class DNSLookupResults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DNSLookupResults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\MailSlurp\Models\DNSLookupResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets results + * + * @return \MailSlurp\Models\DNSLookupResult[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \MailSlurp\Models\DNSLookupResult[] $results results + * + * @return self + */ + public function setResults($results) + { + + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DeliveryStatusDto.php b/lib/Models/DeliveryStatusDto.php new file mode 100644 index 00000000..d06089cd --- /dev/null +++ b/lib/Models/DeliveryStatusDto.php @@ -0,0 +1,892 @@ + + */ +class DeliveryStatusDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeliveryStatusDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'sent_id' => 'string', + 'remote_mta_ip' => 'string', + 'inbox_id' => 'string', + 'reporting_mta' => 'string', + 'recipients' => 'string[]', + 'smtp_response' => 'string', + 'smtp_status_code' => 'int', + 'processing_time_millis' => 'int', + 'received' => '\DateTime', + 'subject' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'sent_id' => 'uuid', + 'remote_mta_ip' => null, + 'inbox_id' => 'uuid', + 'reporting_mta' => null, + 'recipients' => null, + 'smtp_response' => null, + 'smtp_status_code' => 'int32', + 'processing_time_millis' => 'int64', + 'received' => 'date-time', + 'subject' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'sent_id' => false, + 'remote_mta_ip' => false, + 'inbox_id' => false, + 'reporting_mta' => false, + 'recipients' => false, + 'smtp_response' => false, + 'smtp_status_code' => false, + 'processing_time_millis' => false, + 'received' => false, + 'subject' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'sent_id' => 'sentId', + 'remote_mta_ip' => 'remoteMtaIp', + 'inbox_id' => 'inboxId', + 'reporting_mta' => 'reportingMta', + 'recipients' => 'recipients', + 'smtp_response' => 'smtpResponse', + 'smtp_status_code' => 'smtpStatusCode', + 'processing_time_millis' => 'processingTimeMillis', + 'received' => 'received', + 'subject' => 'subject', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'sent_id' => 'setSentId', + 'remote_mta_ip' => 'setRemoteMtaIp', + 'inbox_id' => 'setInboxId', + 'reporting_mta' => 'setReportingMta', + 'recipients' => 'setRecipients', + 'smtp_response' => 'setSmtpResponse', + 'smtp_status_code' => 'setSmtpStatusCode', + 'processing_time_millis' => 'setProcessingTimeMillis', + 'received' => 'setReceived', + 'subject' => 'setSubject', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'sent_id' => 'getSentId', + 'remote_mta_ip' => 'getRemoteMtaIp', + 'inbox_id' => 'getInboxId', + 'reporting_mta' => 'getReportingMta', + 'recipients' => 'getRecipients', + 'smtp_response' => 'getSmtpResponse', + 'smtp_status_code' => 'getSmtpStatusCode', + 'processing_time_millis' => 'getProcessingTimeMillis', + 'received' => 'getReceived', + 'subject' => 'getSubject', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('sent_id', $data ?? [], null); + $this->setIfExists('remote_mta_ip', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('reporting_mta', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('smtp_response', $data ?? [], null); + $this->setIfExists('smtp_status_code', $data ?? [], null); + $this->setIfExists('processing_time_millis', $data ?? [], null); + $this->setIfExists('received', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets sent_id + * + * @return string|null + */ + public function getSentId() + { + return $this->container['sent_id']; + } + + /** + * Sets sent_id + * + * @param string|null $sent_id sent_id + * + * @return self + */ + public function setSentId($sent_id) + { + + if (is_null($sent_id)) { + throw new \InvalidArgumentException('non-nullable sent_id cannot be null'); + } + + $this->container['sent_id'] = $sent_id; + + return $this; + } + + /** + * Gets remote_mta_ip + * + * @return string|null + */ + public function getRemoteMtaIp() + { + return $this->container['remote_mta_ip']; + } + + /** + * Sets remote_mta_ip + * + * @param string|null $remote_mta_ip remote_mta_ip + * + * @return self + */ + public function setRemoteMtaIp($remote_mta_ip) + { + + if (is_null($remote_mta_ip)) { + throw new \InvalidArgumentException('non-nullable remote_mta_ip cannot be null'); + } + + $this->container['remote_mta_ip'] = $remote_mta_ip; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets reporting_mta + * + * @return string|null + */ + public function getReportingMta() + { + return $this->container['reporting_mta']; + } + + /** + * Sets reporting_mta + * + * @param string|null $reporting_mta reporting_mta + * + * @return self + */ + public function setReportingMta($reporting_mta) + { + + if (is_null($reporting_mta)) { + throw new \InvalidArgumentException('non-nullable reporting_mta cannot be null'); + } + + $this->container['reporting_mta'] = $reporting_mta; + + return $this; + } + + /** + * Gets recipients + * + * @return string[]|null + */ + public function getRecipients() + { + return $this->container['recipients']; + } + + /** + * Sets recipients + * + * @param string[]|null $recipients recipients + * + * @return self + */ + public function setRecipients($recipients) + { + + if (is_null($recipients)) { + throw new \InvalidArgumentException('non-nullable recipients cannot be null'); + } + + $this->container['recipients'] = $recipients; + + return $this; + } + + /** + * Gets smtp_response + * + * @return string|null + */ + public function getSmtpResponse() + { + return $this->container['smtp_response']; + } + + /** + * Sets smtp_response + * + * @param string|null $smtp_response smtp_response + * + * @return self + */ + public function setSmtpResponse($smtp_response) + { + + if (is_null($smtp_response)) { + throw new \InvalidArgumentException('non-nullable smtp_response cannot be null'); + } + + $this->container['smtp_response'] = $smtp_response; + + return $this; + } + + /** + * Gets smtp_status_code + * + * @return int|null + */ + public function getSmtpStatusCode() + { + return $this->container['smtp_status_code']; + } + + /** + * Sets smtp_status_code + * + * @param int|null $smtp_status_code smtp_status_code + * + * @return self + */ + public function setSmtpStatusCode($smtp_status_code) + { + + if (is_null($smtp_status_code)) { + throw new \InvalidArgumentException('non-nullable smtp_status_code cannot be null'); + } + + $this->container['smtp_status_code'] = $smtp_status_code; + + return $this; + } + + /** + * Gets processing_time_millis + * + * @return int|null + */ + public function getProcessingTimeMillis() + { + return $this->container['processing_time_millis']; + } + + /** + * Sets processing_time_millis + * + * @param int|null $processing_time_millis processing_time_millis + * + * @return self + */ + public function setProcessingTimeMillis($processing_time_millis) + { + + if (is_null($processing_time_millis)) { + throw new \InvalidArgumentException('non-nullable processing_time_millis cannot be null'); + } + + $this->container['processing_time_millis'] = $processing_time_millis; + + return $this; + } + + /** + * Gets received + * + * @return \DateTime|null + */ + public function getReceived() + { + return $this->container['received']; + } + + /** + * Sets received + * + * @param \DateTime|null $received received + * + * @return self + */ + public function setReceived($received) + { + + if (is_null($received)) { + throw new \InvalidArgumentException('non-nullable received cannot be null'); + } + + $this->container['received'] = $received; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DescribeDomainOptions.php b/lib/Models/DescribeDomainOptions.php new file mode 100644 index 00000000..2b2ef45b --- /dev/null +++ b/lib/Models/DescribeDomainOptions.php @@ -0,0 +1,416 @@ + + */ +class DescribeDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DescribeDomainOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'domain' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'domain' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'domain' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'domain' => 'domain' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'domain' => 'setDomain' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'domain' => 'getDomain' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('domain', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain domain + * + * @return self + */ + public function setDomain($domain) + { + + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + + $this->container['domain'] = $domain; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DescribeMailServerDomainResult.php b/lib/Models/DescribeMailServerDomainResult.php new file mode 100644 index 00000000..b93600a3 --- /dev/null +++ b/lib/Models/DescribeMailServerDomainResult.php @@ -0,0 +1,498 @@ + + */ +class DescribeMailServerDomainResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DescribeMailServerDomainResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mx_records' => '\MailSlurp\Models\NameServerRecord[]', + 'domain' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mx_records' => null, + 'domain' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mx_records' => false, + 'domain' => false, + 'message' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mx_records' => 'mxRecords', + 'domain' => 'domain', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mx_records' => 'setMxRecords', + 'domain' => 'setDomain', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mx_records' => 'getMxRecords', + 'domain' => 'getDomain', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mx_records', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['mx_records'] === null) { + $invalidProperties[] = "'mx_records' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mx_records + * + * @return \MailSlurp\Models\NameServerRecord[] + */ + public function getMxRecords() + { + return $this->container['mx_records']; + } + + /** + * Sets mx_records + * + * @param \MailSlurp\Models\NameServerRecord[] $mx_records mx_records + * + * @return self + */ + public function setMxRecords($mx_records) + { + + if (is_null($mx_records)) { + throw new \InvalidArgumentException('non-nullable mx_records cannot be null'); + } + + $this->container['mx_records'] = $mx_records; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain domain + * + * @return self + */ + public function setDomain($domain) + { + + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DomainDto.php b/lib/Models/DomainDto.php new file mode 100644 index 00000000..2d5fc39a --- /dev/null +++ b/lib/Models/DomainDto.php @@ -0,0 +1,844 @@ + + */ +class DomainDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DomainDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'domain' => 'string', + 'verification_token' => 'string', + 'dkim_tokens' => 'string[]', + 'is_verified' => 'bool', + 'domain_name_records' => '\MailSlurp\Models\DomainNameRecord[]', + 'catch_all_inbox_id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'domain_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'domain' => null, + 'verification_token' => null, + 'dkim_tokens' => null, + 'is_verified' => null, + 'domain_name_records' => null, + 'catch_all_inbox_id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'domain_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'domain' => false, + 'verification_token' => false, + 'dkim_tokens' => false, + 'is_verified' => false, + 'domain_name_records' => false, + 'catch_all_inbox_id' => true, + 'created_at' => false, + 'updated_at' => false, + 'domain_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'domain' => 'domain', + 'verification_token' => 'verificationToken', + 'dkim_tokens' => 'dkimTokens', + 'is_verified' => 'isVerified', + 'domain_name_records' => 'domainNameRecords', + 'catch_all_inbox_id' => 'catchAllInboxId', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'domain_type' => 'domainType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'domain' => 'setDomain', + 'verification_token' => 'setVerificationToken', + 'dkim_tokens' => 'setDkimTokens', + 'is_verified' => 'setIsVerified', + 'domain_name_records' => 'setDomainNameRecords', + 'catch_all_inbox_id' => 'setCatchAllInboxId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'domain_type' => 'setDomainType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'domain' => 'getDomain', + 'verification_token' => 'getVerificationToken', + 'dkim_tokens' => 'getDkimTokens', + 'is_verified' => 'getIsVerified', + 'domain_name_records' => 'getDomainNameRecords', + 'catch_all_inbox_id' => 'getCatchAllInboxId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'domain_type' => 'getDomainType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDomainTypeAllowableValues() + { + return [ + self::DOMAIN_TYPE_HTTP_INBOX, + self::DOMAIN_TYPE_SMTP_DOMAIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('verification_token', $data ?? [], null); + $this->setIfExists('dkim_tokens', $data ?? [], null); + $this->setIfExists('is_verified', $data ?? [], null); + $this->setIfExists('domain_name_records', $data ?? [], null); + $this->setIfExists('catch_all_inbox_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('domain_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + if ($this->container['verification_token'] === null) { + $invalidProperties[] = "'verification_token' can't be null"; + } + if ($this->container['dkim_tokens'] === null) { + $invalidProperties[] = "'dkim_tokens' can't be null"; + } + if ($this->container['is_verified'] === null) { + $invalidProperties[] = "'is_verified' can't be null"; + } + if ($this->container['domain_name_records'] === null) { + $invalidProperties[] = "'domain_name_records' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['domain_type'] === null) { + $invalidProperties[] = "'domain_type' can't be null"; + } + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'domain_type', must be one of '%s'", + $this->container['domain_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain Custom domain name + * + * @return self + */ + public function setDomain($domain) + { + + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets verification_token + * + * @return string + */ + public function getVerificationToken() + { + return $this->container['verification_token']; + } + + /** + * Sets verification_token + * + * @param string $verification_token Verification tokens + * + * @return self + */ + public function setVerificationToken($verification_token) + { + + if (is_null($verification_token)) { + throw new \InvalidArgumentException('non-nullable verification_token cannot be null'); + } + + $this->container['verification_token'] = $verification_token; + + return $this; + } + + /** + * Gets dkim_tokens + * + * @return string[] + */ + public function getDkimTokens() + { + return $this->container['dkim_tokens']; + } + + /** + * Sets dkim_tokens + * + * @param string[] $dkim_tokens Unique token DKIM tokens + * + * @return self + */ + public function setDkimTokens($dkim_tokens) + { + + if (is_null($dkim_tokens)) { + throw new \InvalidArgumentException('non-nullable dkim_tokens cannot be null'); + } + + $this->container['dkim_tokens'] = $dkim_tokens; + + return $this; + } + + /** + * Gets is_verified + * + * @return bool + */ + public function getIsVerified() + { + return $this->container['is_verified']; + } + + /** + * Sets is_verified + * + * @param bool $is_verified Whether domain has been verified or not. If the domain is not verified after 72 hours there is most likely an issue with the domains DNS records. + * + * @return self + */ + public function setIsVerified($is_verified) + { + + if (is_null($is_verified)) { + throw new \InvalidArgumentException('non-nullable is_verified cannot be null'); + } + + $this->container['is_verified'] = $is_verified; + + return $this; + } + + /** + * Gets domain_name_records + * + * @return \MailSlurp\Models\DomainNameRecord[] + */ + public function getDomainNameRecords() + { + return $this->container['domain_name_records']; + } + + /** + * Sets domain_name_records + * + * @param \MailSlurp\Models\DomainNameRecord[] $domain_name_records List of DNS domain name records (C, MX, TXT) etc that you must add to the DNS server associated with your domain provider. + * + * @return self + */ + public function setDomainNameRecords($domain_name_records) + { + + if (is_null($domain_name_records)) { + throw new \InvalidArgumentException('non-nullable domain_name_records cannot be null'); + } + + $this->container['domain_name_records'] = $domain_name_records; + + return $this; + } + + /** + * Gets catch_all_inbox_id + * + * @return string|null + */ + public function getCatchAllInboxId() + { + return $this->container['catch_all_inbox_id']; + } + + /** + * Sets catch_all_inbox_id + * + * @param string|null $catch_all_inbox_id The optional catch all inbox that will receive emails sent to the domain that cannot be matched. + * + * @return self + */ + public function setCatchAllInboxId($catch_all_inbox_id) + { + + if (is_null($catch_all_inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('catch_all_inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['catch_all_inbox_id'] = $catch_all_inbox_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets domain_type + * + * @return string + */ + public function getDomainType() + { + return $this->container['domain_type']; + } + + /** + * Sets domain_type + * + * @param string $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. + * + * @return self + */ + public function setDomainType($domain_type) + { + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!in_array($domain_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'domain_type', must be one of '%s'", + $domain_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($domain_type)) { + throw new \InvalidArgumentException('non-nullable domain_type cannot be null'); + } + + $this->container['domain_type'] = $domain_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DomainNameRecord.php b/lib/Models/DomainNameRecord.php new file mode 100644 index 00000000..24edf7e3 --- /dev/null +++ b/lib/Models/DomainNameRecord.php @@ -0,0 +1,741 @@ + + */ +class DomainNameRecord implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DomainNameRecord'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'record_type' => 'string', + 'name' => 'string', + 'record_entries' => 'string[]', + 'ttl' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'record_type' => null, + 'name' => null, + 'record_entries' => null, + 'ttl' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'record_type' => false, + 'name' => false, + 'record_entries' => false, + 'ttl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'record_type' => 'recordType', + 'name' => 'name', + 'record_entries' => 'recordEntries', + 'ttl' => 'ttl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'record_type' => 'setRecordType', + 'name' => 'setName', + 'record_entries' => 'setRecordEntries', + 'ttl' => 'setTtl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'record_type' => 'getRecordType', + 'name' => 'getName', + 'record_entries' => 'getRecordEntries', + 'ttl' => 'getTtl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const RECORD_TYPE_A = 'A'; + public const RECORD_TYPE_NS = 'NS'; + public const RECORD_TYPE_MD = 'MD'; + public const RECORD_TYPE_MF = 'MF'; + public const RECORD_TYPE_CNAME = 'CNAME'; + public const RECORD_TYPE_SOA = 'SOA'; + public const RECORD_TYPE_MB = 'MB'; + public const RECORD_TYPE_MG = 'MG'; + public const RECORD_TYPE_MR = 'MR'; + public const RECORD_TYPE_NULL = 'NULL'; + public const RECORD_TYPE_WKS = 'WKS'; + public const RECORD_TYPE_PTR = 'PTR'; + public const RECORD_TYPE_HINFO = 'HINFO'; + public const RECORD_TYPE_MINFO = 'MINFO'; + public const RECORD_TYPE_MX = 'MX'; + public const RECORD_TYPE_TXT = 'TXT'; + public const RECORD_TYPE_RP = 'RP'; + public const RECORD_TYPE_AFSDB = 'AFSDB'; + public const RECORD_TYPE_X25 = 'X25'; + public const RECORD_TYPE_ISDN = 'ISDN'; + public const RECORD_TYPE_RT = 'RT'; + public const RECORD_TYPE_NSAP = 'NSAP'; + public const RECORD_TYPE_NSAP_PTR = 'NSAP_PTR'; + public const RECORD_TYPE_SIG = 'SIG'; + public const RECORD_TYPE_KEY = 'KEY'; + public const RECORD_TYPE_PX = 'PX'; + public const RECORD_TYPE_GPOS = 'GPOS'; + public const RECORD_TYPE_AAAA = 'AAAA'; + public const RECORD_TYPE_LOC = 'LOC'; + public const RECORD_TYPE_NXT = 'NXT'; + public const RECORD_TYPE_EID = 'EID'; + public const RECORD_TYPE_NIMLOC = 'NIMLOC'; + public const RECORD_TYPE_SRV = 'SRV'; + public const RECORD_TYPE_ATMA = 'ATMA'; + public const RECORD_TYPE_NAPTR = 'NAPTR'; + public const RECORD_TYPE_KX = 'KX'; + public const RECORD_TYPE_CERT = 'CERT'; + public const RECORD_TYPE_A6 = 'A6'; + public const RECORD_TYPE_DNAME = 'DNAME'; + public const RECORD_TYPE_SINK = 'SINK'; + public const RECORD_TYPE_OPT = 'OPT'; + public const RECORD_TYPE_APL = 'APL'; + public const RECORD_TYPE_DS = 'DS'; + public const RECORD_TYPE_SSHFP = 'SSHFP'; + public const RECORD_TYPE_IPSECKEY = 'IPSECKEY'; + public const RECORD_TYPE_RRSIG = 'RRSIG'; + public const RECORD_TYPE_NSEC = 'NSEC'; + public const RECORD_TYPE_DNSKEY = 'DNSKEY'; + public const RECORD_TYPE_DHCID = 'DHCID'; + public const RECORD_TYPE_NSEC3 = 'NSEC3'; + public const RECORD_TYPE_NSEC3_PARAM = 'NSEC3PARAM'; + public const RECORD_TYPE_TLSA = 'TLSA'; + public const RECORD_TYPE_SMIMEA = 'SMIMEA'; + public const RECORD_TYPE_HIP = 'HIP'; + public const RECORD_TYPE_NINFO = 'NINFO'; + public const RECORD_TYPE_RKEY = 'RKEY'; + public const RECORD_TYPE_TALINK = 'TALINK'; + public const RECORD_TYPE_CDS = 'CDS'; + public const RECORD_TYPE_CDNSKEY = 'CDNSKEY'; + public const RECORD_TYPE_OPENPGPKEY = 'OPENPGPKEY'; + public const RECORD_TYPE_CSYNC = 'CSYNC'; + public const RECORD_TYPE_ZONEMD = 'ZONEMD'; + public const RECORD_TYPE_SVCB = 'SVCB'; + public const RECORD_TYPE_HTTPS = 'HTTPS'; + public const RECORD_TYPE_SPF = 'SPF'; + public const RECORD_TYPE_UINFO = 'UINFO'; + public const RECORD_TYPE_UID = 'UID'; + public const RECORD_TYPE_GID = 'GID'; + public const RECORD_TYPE_UNSPEC = 'UNSPEC'; + public const RECORD_TYPE_NID = 'NID'; + public const RECORD_TYPE_L32 = 'L32'; + public const RECORD_TYPE_L64 = 'L64'; + public const RECORD_TYPE_LP = 'LP'; + public const RECORD_TYPE_EUI48 = 'EUI48'; + public const RECORD_TYPE_EUI64 = 'EUI64'; + public const RECORD_TYPE_TKEY = 'TKEY'; + public const RECORD_TYPE_TSIG = 'TSIG'; + public const RECORD_TYPE_IXFR = 'IXFR'; + public const RECORD_TYPE_AXFR = 'AXFR'; + public const RECORD_TYPE_MAILB = 'MAILB'; + public const RECORD_TYPE_MAILA = 'MAILA'; + public const RECORD_TYPE_ANY = 'ANY'; + public const RECORD_TYPE_URI = 'URI'; + public const RECORD_TYPE_CAA = 'CAA'; + public const RECORD_TYPE_AVC = 'AVC'; + public const RECORD_TYPE_DOA = 'DOA'; + public const RECORD_TYPE_AMTRELAY = 'AMTRELAY'; + public const RECORD_TYPE_TA = 'TA'; + public const RECORD_TYPE_DLV = 'DLV'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRecordTypeAllowableValues() + { + return [ + self::RECORD_TYPE_A, + self::RECORD_TYPE_NS, + self::RECORD_TYPE_MD, + self::RECORD_TYPE_MF, + self::RECORD_TYPE_CNAME, + self::RECORD_TYPE_SOA, + self::RECORD_TYPE_MB, + self::RECORD_TYPE_MG, + self::RECORD_TYPE_MR, + self::RECORD_TYPE_NULL, + self::RECORD_TYPE_WKS, + self::RECORD_TYPE_PTR, + self::RECORD_TYPE_HINFO, + self::RECORD_TYPE_MINFO, + self::RECORD_TYPE_MX, + self::RECORD_TYPE_TXT, + self::RECORD_TYPE_RP, + self::RECORD_TYPE_AFSDB, + self::RECORD_TYPE_X25, + self::RECORD_TYPE_ISDN, + self::RECORD_TYPE_RT, + self::RECORD_TYPE_NSAP, + self::RECORD_TYPE_NSAP_PTR, + self::RECORD_TYPE_SIG, + self::RECORD_TYPE_KEY, + self::RECORD_TYPE_PX, + self::RECORD_TYPE_GPOS, + self::RECORD_TYPE_AAAA, + self::RECORD_TYPE_LOC, + self::RECORD_TYPE_NXT, + self::RECORD_TYPE_EID, + self::RECORD_TYPE_NIMLOC, + self::RECORD_TYPE_SRV, + self::RECORD_TYPE_ATMA, + self::RECORD_TYPE_NAPTR, + self::RECORD_TYPE_KX, + self::RECORD_TYPE_CERT, + self::RECORD_TYPE_A6, + self::RECORD_TYPE_DNAME, + self::RECORD_TYPE_SINK, + self::RECORD_TYPE_OPT, + self::RECORD_TYPE_APL, + self::RECORD_TYPE_DS, + self::RECORD_TYPE_SSHFP, + self::RECORD_TYPE_IPSECKEY, + self::RECORD_TYPE_RRSIG, + self::RECORD_TYPE_NSEC, + self::RECORD_TYPE_DNSKEY, + self::RECORD_TYPE_DHCID, + self::RECORD_TYPE_NSEC3, + self::RECORD_TYPE_NSEC3_PARAM, + self::RECORD_TYPE_TLSA, + self::RECORD_TYPE_SMIMEA, + self::RECORD_TYPE_HIP, + self::RECORD_TYPE_NINFO, + self::RECORD_TYPE_RKEY, + self::RECORD_TYPE_TALINK, + self::RECORD_TYPE_CDS, + self::RECORD_TYPE_CDNSKEY, + self::RECORD_TYPE_OPENPGPKEY, + self::RECORD_TYPE_CSYNC, + self::RECORD_TYPE_ZONEMD, + self::RECORD_TYPE_SVCB, + self::RECORD_TYPE_HTTPS, + self::RECORD_TYPE_SPF, + self::RECORD_TYPE_UINFO, + self::RECORD_TYPE_UID, + self::RECORD_TYPE_GID, + self::RECORD_TYPE_UNSPEC, + self::RECORD_TYPE_NID, + self::RECORD_TYPE_L32, + self::RECORD_TYPE_L64, + self::RECORD_TYPE_LP, + self::RECORD_TYPE_EUI48, + self::RECORD_TYPE_EUI64, + self::RECORD_TYPE_TKEY, + self::RECORD_TYPE_TSIG, + self::RECORD_TYPE_IXFR, + self::RECORD_TYPE_AXFR, + self::RECORD_TYPE_MAILB, + self::RECORD_TYPE_MAILA, + self::RECORD_TYPE_ANY, + self::RECORD_TYPE_URI, + self::RECORD_TYPE_CAA, + self::RECORD_TYPE_AVC, + self::RECORD_TYPE_DOA, + self::RECORD_TYPE_AMTRELAY, + self::RECORD_TYPE_TA, + self::RECORD_TYPE_DLV, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('record_type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('record_entries', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['record_type'] === null) { + $invalidProperties[] = "'record_type' can't be null"; + } + $allowedValues = $this->getRecordTypeAllowableValues(); + if (!is_null($this->container['record_type']) && !in_array($this->container['record_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'record_type', must be one of '%s'", + $this->container['record_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['record_entries'] === null) { + $invalidProperties[] = "'record_entries' can't be null"; + } + if ($this->container['ttl'] === null) { + $invalidProperties[] = "'ttl' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets record_type + * + * @return string + */ + public function getRecordType() + { + return $this->container['record_type']; + } + + /** + * Sets record_type + * + * @param string $record_type Domain Name Server Record Types + * + * @return self + */ + public function setRecordType($record_type) + { + $allowedValues = $this->getRecordTypeAllowableValues(); + if (!in_array($record_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'record_type', must be one of '%s'", + $record_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($record_type)) { + throw new \InvalidArgumentException('non-nullable record_type cannot be null'); + } + + $this->container['record_type'] = $record_type; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets record_entries + * + * @return string[] + */ + public function getRecordEntries() + { + return $this->container['record_entries']; + } + + /** + * Sets record_entries + * + * @param string[] $record_entries record_entries + * + * @return self + */ + public function setRecordEntries($record_entries) + { + + if (is_null($record_entries)) { + throw new \InvalidArgumentException('non-nullable record_entries cannot be null'); + } + + $this->container['record_entries'] = $record_entries; + + return $this; + } + + /** + * Gets ttl + * + * @return int + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int $ttl ttl + * + * @return self + */ + public function setTtl($ttl) + { + + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + + $this->container['ttl'] = $ttl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DomainPreview.php b/lib/Models/DomainPreview.php new file mode 100644 index 00000000..44998470 --- /dev/null +++ b/lib/Models/DomainPreview.php @@ -0,0 +1,649 @@ + + */ +class DomainPreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DomainPreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'domain' => 'string', + 'catch_all_inbox_id' => 'string', + 'created_at' => '\DateTime', + 'domain_type' => 'string', + 'is_verified' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'domain' => null, + 'catch_all_inbox_id' => 'uuid', + 'created_at' => 'date-time', + 'domain_type' => null, + 'is_verified' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domain' => false, + 'catch_all_inbox_id' => true, + 'created_at' => false, + 'domain_type' => false, + 'is_verified' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'domain' => 'domain', + 'catch_all_inbox_id' => 'catchAllInboxId', + 'created_at' => 'createdAt', + 'domain_type' => 'domainType', + 'is_verified' => 'isVerified' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'domain' => 'setDomain', + 'catch_all_inbox_id' => 'setCatchAllInboxId', + 'created_at' => 'setCreatedAt', + 'domain_type' => 'setDomainType', + 'is_verified' => 'setIsVerified' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'domain' => 'getDomain', + 'catch_all_inbox_id' => 'getCatchAllInboxId', + 'created_at' => 'getCreatedAt', + 'domain_type' => 'getDomainType', + 'is_verified' => 'getIsVerified' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDomainTypeAllowableValues() + { + return [ + self::DOMAIN_TYPE_HTTP_INBOX, + self::DOMAIN_TYPE_SMTP_DOMAIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + $this->setIfExists('catch_all_inbox_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('domain_type', $data ?? [], null); + $this->setIfExists('is_verified', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['domain_type'] === null) { + $invalidProperties[] = "'domain_type' can't be null"; + } + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'domain_type', must be one of '%s'", + $this->container['domain_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['is_verified'] === null) { + $invalidProperties[] = "'is_verified' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain() + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain domain + * + * @return self + */ + public function setDomain($domain) + { + + if (is_null($domain)) { + throw new \InvalidArgumentException('non-nullable domain cannot be null'); + } + + $this->container['domain'] = $domain; + + return $this; + } + + /** + * Gets catch_all_inbox_id + * + * @return string|null + */ + public function getCatchAllInboxId() + { + return $this->container['catch_all_inbox_id']; + } + + /** + * Sets catch_all_inbox_id + * + * @param string|null $catch_all_inbox_id catch_all_inbox_id + * + * @return self + */ + public function setCatchAllInboxId($catch_all_inbox_id) + { + + if (is_null($catch_all_inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('catch_all_inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['catch_all_inbox_id'] = $catch_all_inbox_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets domain_type + * + * @return string + */ + public function getDomainType() + { + return $this->container['domain_type']; + } + + /** + * Sets domain_type + * + * @param string $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails. + * + * @return self + */ + public function setDomainType($domain_type) + { + $allowedValues = $this->getDomainTypeAllowableValues(); + if (!in_array($domain_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'domain_type', must be one of '%s'", + $domain_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($domain_type)) { + throw new \InvalidArgumentException('non-nullable domain_type cannot be null'); + } + + $this->container['domain_type'] = $domain_type; + + return $this; + } + + /** + * Gets is_verified + * + * @return bool + */ + public function getIsVerified() + { + return $this->container['is_verified']; + } + + /** + * Sets is_verified + * + * @param bool $is_verified is_verified + * + * @return self + */ + public function setIsVerified($is_verified) + { + + if (is_null($is_verified)) { + throw new \InvalidArgumentException('non-nullable is_verified cannot be null'); + } + + $this->container['is_verified'] = $is_verified; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/DownloadAttachmentDto.php b/lib/Models/DownloadAttachmentDto.php new file mode 100644 index 00000000..d293f4c1 --- /dev/null +++ b/lib/Models/DownloadAttachmentDto.php @@ -0,0 +1,494 @@ + + */ +class DownloadAttachmentDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DownloadAttachmentDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'base64_file_contents' => 'string', + 'content_type' => 'string', + 'size_bytes' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'base64_file_contents' => null, + 'content_type' => null, + 'size_bytes' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'base64_file_contents' => false, + 'content_type' => false, + 'size_bytes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'base64_file_contents' => 'base64FileContents', + 'content_type' => 'contentType', + 'size_bytes' => 'sizeBytes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'base64_file_contents' => 'setBase64FileContents', + 'content_type' => 'setContentType', + 'size_bytes' => 'setSizeBytes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'base64_file_contents' => 'getBase64FileContents', + 'content_type' => 'getContentType', + 'size_bytes' => 'getSizeBytes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('base64_file_contents', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('size_bytes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['base64_file_contents'] === null) { + $invalidProperties[] = "'base64_file_contents' can't be null"; + } + if ($this->container['content_type'] === null) { + $invalidProperties[] = "'content_type' can't be null"; + } + if ($this->container['size_bytes'] === null) { + $invalidProperties[] = "'size_bytes' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets base64_file_contents + * + * @return string + */ + public function getBase64FileContents() + { + return $this->container['base64_file_contents']; + } + + /** + * Sets base64_file_contents + * + * @param string $base64_file_contents Base64 encoded string of attachment bytes. Decode the base64 encoded string to get the raw contents. If the file has a content type such as `text/html` you can read the contents directly by converting it to string using `utf-8` encoding. + * + * @return self + */ + public function setBase64FileContents($base64_file_contents) + { + + if (is_null($base64_file_contents)) { + throw new \InvalidArgumentException('non-nullable base64_file_contents cannot be null'); + } + + $this->container['base64_file_contents'] = $base64_file_contents; + + return $this; + } + + /** + * Gets content_type + * + * @return string + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string $content_type Content type of attachment. Examples are `image/png`, `application/msword`, `text/csv` etc. + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets size_bytes + * + * @return int + */ + public function getSizeBytes() + { + return $this->container['size_bytes']; + } + + /** + * Sets size_bytes + * + * @param int $size_bytes Size in bytes of attachment content + * + * @return self + */ + public function setSizeBytes($size_bytes) + { + + if (is_null($size_bytes)) { + throw new \InvalidArgumentException('non-nullable size_bytes cannot be null'); + } + + $this->container['size_bytes'] = $size_bytes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/Email.php b/lib/Models/Email.php new file mode 100644 index 00000000..4965bda4 --- /dev/null +++ b/lib/Models/Email.php @@ -0,0 +1,1413 @@ + + */ +class Email implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Email'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'domain_id' => 'string', + 'to' => 'string[]', + 'from' => 'string', + 'sender' => '\MailSlurp\Models\Sender', + 'recipients' => '\MailSlurp\Models\EmailRecipients', + 'reply_to' => 'string', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'headers' => 'array', + 'attachments' => 'string[]', + 'subject' => 'string', + 'body' => 'string', + 'body_excerpt' => 'string', + 'body_md5_hash' => 'string', + 'is_html' => 'bool', + 'charset' => 'string', + 'analysis' => '\MailSlurp\Models\EmailAnalysis', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'read' => 'bool', + 'team_access' => 'bool', + 'html' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'domain_id' => 'uuid', + 'to' => null, + 'from' => null, + 'sender' => null, + 'recipients' => null, + 'reply_to' => null, + 'cc' => null, + 'bcc' => null, + 'headers' => null, + 'attachments' => null, + 'subject' => null, + 'body' => null, + 'body_excerpt' => null, + 'body_md5_hash' => null, + 'is_html' => null, + 'charset' => null, + 'analysis' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'read' => null, + 'team_access' => null, + 'html' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'inbox_id' => false, + 'domain_id' => true, + 'to' => false, + 'from' => true, + 'sender' => true, + 'recipients' => true, + 'reply_to' => true, + 'cc' => true, + 'bcc' => true, + 'headers' => true, + 'attachments' => true, + 'subject' => true, + 'body' => true, + 'body_excerpt' => true, + 'body_md5_hash' => true, + 'is_html' => true, + 'charset' => true, + 'analysis' => true, + 'created_at' => false, + 'updated_at' => false, + 'read' => false, + 'team_access' => false, + 'html' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'domain_id' => 'domainId', + 'to' => 'to', + 'from' => 'from', + 'sender' => 'sender', + 'recipients' => 'recipients', + 'reply_to' => 'replyTo', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'headers' => 'headers', + 'attachments' => 'attachments', + 'subject' => 'subject', + 'body' => 'body', + 'body_excerpt' => 'bodyExcerpt', + 'body_md5_hash' => 'bodyMD5Hash', + 'is_html' => 'isHTML', + 'charset' => 'charset', + 'analysis' => 'analysis', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'read' => 'read', + 'team_access' => 'teamAccess', + 'html' => 'html' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'domain_id' => 'setDomainId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'sender' => 'setSender', + 'recipients' => 'setRecipients', + 'reply_to' => 'setReplyTo', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'headers' => 'setHeaders', + 'attachments' => 'setAttachments', + 'subject' => 'setSubject', + 'body' => 'setBody', + 'body_excerpt' => 'setBodyExcerpt', + 'body_md5_hash' => 'setBodyMd5Hash', + 'is_html' => 'setIsHtml', + 'charset' => 'setCharset', + 'analysis' => 'setAnalysis', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'read' => 'setRead', + 'team_access' => 'setTeamAccess', + 'html' => 'setHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'domain_id' => 'getDomainId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'sender' => 'getSender', + 'recipients' => 'getRecipients', + 'reply_to' => 'getReplyTo', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'headers' => 'getHeaders', + 'attachments' => 'getAttachments', + 'subject' => 'getSubject', + 'body' => 'getBody', + 'body_excerpt' => 'getBodyExcerpt', + 'body_md5_hash' => 'getBodyMd5Hash', + 'is_html' => 'getIsHtml', + 'charset' => 'getCharset', + 'analysis' => 'getAnalysis', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'read' => 'getRead', + 'team_access' => 'getTeamAccess', + 'html' => 'getHtml' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('body_excerpt', $data ?? [], null); + $this->setIfExists('body_md5_hash', $data ?? [], null); + $this->setIfExists('is_html', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('analysis', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('team_access', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + if ($this->container['team_access'] === null) { + $invalidProperties[] = "'team_access' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the email entity + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id ID of user that email belongs to + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id ID of the inbox that received the email + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id ID of the domain that received the email + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from Who the email was sent from. An email address - see fromName for the sender name. + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets sender + * + * @return \MailSlurp\Models\Sender|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param \MailSlurp\Models\Sender|null $sender sender + * + * @return self + */ + public function setSender($sender) + { + + if (is_null($sender)) { + array_push($this->openAPINullablesSetToNull, 'sender'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sender', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets recipients + * + * @return \MailSlurp\Models\EmailRecipients|null + */ + public function getRecipients() + { + return $this->container['recipients']; + } + + /** + * Sets recipients + * + * @param \MailSlurp\Models\EmailRecipients|null $recipients recipients + * + * @return self + */ + public function setRecipients($recipients) + { + + if (is_null($recipients)) { + array_push($this->openAPINullablesSetToNull, 'recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['recipients'] = $recipients; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo() + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to The `replyTo` field on the received email message + * + * @return self + */ + public function setReplyTo($reply_to) + { + + if (is_null($reply_to)) { + array_push($this->openAPINullablesSetToNull, 'reply_to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reply_to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers Collection of SMTP headers attached to email + * + * @return self + */ + public function setHeaders($headers) + { + + if (is_null($headers)) { + array_push($this->openAPINullablesSetToNull, 'headers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('headers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension. + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject The subject line of the email message as specified by SMTP subject header + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests. + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets body_excerpt + * + * @return string|null + */ + public function getBodyExcerpt() + { + return $this->container['body_excerpt']; + } + + /** + * Sets body_excerpt + * + * @param string|null $body_excerpt An excerpt of the body of the email message for quick preview . + * + * @return self + */ + public function setBodyExcerpt($body_excerpt) + { + + if (is_null($body_excerpt)) { + array_push($this->openAPINullablesSetToNull, 'body_excerpt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_excerpt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_excerpt'] = $body_excerpt; + + return $this; + } + + /** + * Gets body_md5_hash + * + * @return string|null + */ + public function getBodyMd5Hash() + { + return $this->container['body_md5_hash']; + } + + /** + * Sets body_md5_hash + * + * @param string|null $body_md5_hash A hash signature of the email message using MD5. Useful for comparing emails without fetching full body. + * + * @return self + */ + public function setBodyMd5Hash($body_md5_hash) + { + + if (is_null($body_md5_hash)) { + array_push($this->openAPINullablesSetToNull, 'body_md5_hash'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_md5_hash', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_md5_hash'] = $body_md5_hash; + + return $this; + } + + /** + * Gets is_html + * + * @return bool|null + */ + public function getIsHtml() + { + return $this->container['is_html']; + } + + /** + * Sets is_html + * + * @param bool|null $is_html Is the email body content type HTML? + * + * @return self + */ + public function setIsHtml($is_html) + { + + if (is_null($is_html)) { + array_push($this->openAPINullablesSetToNull, 'is_html'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_html', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['is_html'] = $is_html; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset Detected character set of the email body such as UTF-8 + * + * @return self + */ + public function setCharset($charset) + { + + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets analysis + * + * @return \MailSlurp\Models\EmailAnalysis|null + */ + public function getAnalysis() + { + return $this->container['analysis']; + } + + /** + * Sets analysis + * + * @param \MailSlurp\Models\EmailAnalysis|null $analysis analysis + * + * @return self + */ + public function setAnalysis($analysis) + { + + if (is_null($analysis)) { + array_push($this->openAPINullablesSetToNull, 'analysis'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('analysis', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['analysis'] = $analysis; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When was the email received by MailSlurp + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at When was the email last updated + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + + /** + * Gets team_access + * + * @return bool + */ + public function getTeamAccess() + { + return $this->container['team_access']; + } + + /** + * Sets team_access + * + * @param bool $team_access Can the email be accessed by organization team members + * + * @return self + */ + public function setTeamAccess($team_access) + { + + if (is_null($team_access)) { + throw new \InvalidArgumentException('non-nullable team_access cannot be null'); + } + + $this->container['team_access'] = $team_access; + + return $this; + } + + /** + * Gets html + * + * @return bool|null + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param bool|null $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailAnalysis.php b/lib/Models/EmailAnalysis.php new file mode 100644 index 00000000..a6b0a381 --- /dev/null +++ b/lib/Models/EmailAnalysis.php @@ -0,0 +1,592 @@ + + */ +class EmailAnalysis implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailAnalysis'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'spam_verdict' => 'string', + 'virus_verdict' => 'string', + 'spf_verdict' => 'string', + 'dkim_verdict' => 'string', + 'dmarc_verdict' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'spam_verdict' => null, + 'virus_verdict' => null, + 'spf_verdict' => null, + 'dkim_verdict' => null, + 'dmarc_verdict' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'spam_verdict' => true, + 'virus_verdict' => true, + 'spf_verdict' => true, + 'dkim_verdict' => true, + 'dmarc_verdict' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'spam_verdict' => 'spamVerdict', + 'virus_verdict' => 'virusVerdict', + 'spf_verdict' => 'spfVerdict', + 'dkim_verdict' => 'dkimVerdict', + 'dmarc_verdict' => 'dmarcVerdict' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'spam_verdict' => 'setSpamVerdict', + 'virus_verdict' => 'setVirusVerdict', + 'spf_verdict' => 'setSpfVerdict', + 'dkim_verdict' => 'setDkimVerdict', + 'dmarc_verdict' => 'setDmarcVerdict' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'spam_verdict' => 'getSpamVerdict', + 'virus_verdict' => 'getVirusVerdict', + 'spf_verdict' => 'getSpfVerdict', + 'dkim_verdict' => 'getDkimVerdict', + 'dmarc_verdict' => 'getDmarcVerdict' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('spam_verdict', $data ?? [], null); + $this->setIfExists('virus_verdict', $data ?? [], null); + $this->setIfExists('spf_verdict', $data ?? [], null); + $this->setIfExists('dkim_verdict', $data ?? [], null); + $this->setIfExists('dmarc_verdict', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets spam_verdict + * + * @return string|null + */ + public function getSpamVerdict() + { + return $this->container['spam_verdict']; + } + + /** + * Sets spam_verdict + * + * @param string|null $spam_verdict Verdict of spam ranking analysis + * + * @return self + */ + public function setSpamVerdict($spam_verdict) + { + + if (is_null($spam_verdict)) { + array_push($this->openAPINullablesSetToNull, 'spam_verdict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('spam_verdict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['spam_verdict'] = $spam_verdict; + + return $this; + } + + /** + * Gets virus_verdict + * + * @return string|null + */ + public function getVirusVerdict() + { + return $this->container['virus_verdict']; + } + + /** + * Sets virus_verdict + * + * @param string|null $virus_verdict Verdict of virus scan analysis + * + * @return self + */ + public function setVirusVerdict($virus_verdict) + { + + if (is_null($virus_verdict)) { + array_push($this->openAPINullablesSetToNull, 'virus_verdict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virus_verdict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['virus_verdict'] = $virus_verdict; + + return $this; + } + + /** + * Gets spf_verdict + * + * @return string|null + */ + public function getSpfVerdict() + { + return $this->container['spf_verdict']; + } + + /** + * Sets spf_verdict + * + * @param string|null $spf_verdict Verdict of Send Policy Framework record spoofing analysis + * + * @return self + */ + public function setSpfVerdict($spf_verdict) + { + + if (is_null($spf_verdict)) { + array_push($this->openAPINullablesSetToNull, 'spf_verdict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('spf_verdict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['spf_verdict'] = $spf_verdict; + + return $this; + } + + /** + * Gets dkim_verdict + * + * @return string|null + */ + public function getDkimVerdict() + { + return $this->container['dkim_verdict']; + } + + /** + * Sets dkim_verdict + * + * @param string|null $dkim_verdict Verdict of DomainKeys Identified Mail analysis + * + * @return self + */ + public function setDkimVerdict($dkim_verdict) + { + + if (is_null($dkim_verdict)) { + array_push($this->openAPINullablesSetToNull, 'dkim_verdict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dkim_verdict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['dkim_verdict'] = $dkim_verdict; + + return $this; + } + + /** + * Gets dmarc_verdict + * + * @return string|null + */ + public function getDmarcVerdict() + { + return $this->container['dmarc_verdict']; + } + + /** + * Sets dmarc_verdict + * + * @param string|null $dmarc_verdict Verdict of Domain-based Message Authentication Reporting and Conformance analysis + * + * @return self + */ + public function setDmarcVerdict($dmarc_verdict) + { + + if (is_null($dmarc_verdict)) { + array_push($this->openAPINullablesSetToNull, 'dmarc_verdict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dmarc_verdict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['dmarc_verdict'] = $dmarc_verdict; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailContentMatchResult.php b/lib/Models/EmailContentMatchResult.php new file mode 100644 index 00000000..cf17f206 --- /dev/null +++ b/lib/Models/EmailContentMatchResult.php @@ -0,0 +1,455 @@ + + */ +class EmailContentMatchResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailContentMatchResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'pattern' => 'string', + 'matches' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'pattern' => null, + 'matches' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pattern' => false, + 'matches' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'pattern' => 'pattern', + 'matches' => 'matches' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'pattern' => 'setPattern', + 'matches' => 'setMatches' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'pattern' => 'getPattern', + 'matches' => 'getMatches' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('pattern', $data ?? [], null); + $this->setIfExists('matches', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['pattern'] === null) { + $invalidProperties[] = "'pattern' can't be null"; + } + if ($this->container['matches'] === null) { + $invalidProperties[] = "'matches' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets pattern + * + * @return string + */ + public function getPattern() + { + return $this->container['pattern']; + } + + /** + * Sets pattern + * + * @param string $pattern pattern + * + * @return self + */ + public function setPattern($pattern) + { + + if (is_null($pattern)) { + throw new \InvalidArgumentException('non-nullable pattern cannot be null'); + } + + $this->container['pattern'] = $pattern; + + return $this; + } + + /** + * Gets matches + * + * @return string[] + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param string[] $matches matches + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + throw new \InvalidArgumentException('non-nullable matches cannot be null'); + } + + $this->container['matches'] = $matches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailHtmlDto.php b/lib/Models/EmailHtmlDto.php new file mode 100644 index 00000000..820175ae --- /dev/null +++ b/lib/Models/EmailHtmlDto.php @@ -0,0 +1,448 @@ + + */ +class EmailHtmlDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailHtmlDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'subject' => 'string', + 'body' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'subject' => null, + 'body' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'subject' => false, + 'body' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'subject' => 'subject', + 'body' => 'body' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'subject' => 'setSubject', + 'body' => 'setBody' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'subject' => 'getSubject', + 'body' => 'getBody' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailLinksResult.php b/lib/Models/EmailLinksResult.php new file mode 100644 index 00000000..84e706d5 --- /dev/null +++ b/lib/Models/EmailLinksResult.php @@ -0,0 +1,455 @@ + + */ +class EmailLinksResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailLinksResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'links' => 'string[]', + 'body' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'links' => null, + 'body' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'links' => false, + 'body' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'links' => 'links', + 'body' => 'body' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'links' => 'setLinks', + 'body' => 'setBody' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'links' => 'getLinks', + 'body' => 'getBody' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return string[] + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param string[] $links links + * + * @return self + */ + public function setLinks($links) + { + + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailPreview.php b/lib/Models/EmailPreview.php new file mode 100644 index 00000000..3ad946d7 --- /dev/null +++ b/lib/Models/EmailPreview.php @@ -0,0 +1,798 @@ + + */ +class EmailPreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailPreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'domain_id' => 'string', + 'subject' => 'string', + 'to' => 'string[]', + 'from' => 'string', + 'bcc' => 'string[]', + 'cc' => 'string[]', + 'created_at' => '\DateTime', + 'read' => 'bool', + 'attachments' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'domain_id' => 'uuid', + 'subject' => null, + 'to' => null, + 'from' => null, + 'bcc' => null, + 'cc' => null, + 'created_at' => 'date-time', + 'read' => null, + 'attachments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domain_id' => true, + 'subject' => true, + 'to' => true, + 'from' => true, + 'bcc' => true, + 'cc' => true, + 'created_at' => false, + 'read' => false, + 'attachments' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'domain_id' => 'domainId', + 'subject' => 'subject', + 'to' => 'to', + 'from' => 'from', + 'bcc' => 'bcc', + 'cc' => 'cc', + 'created_at' => 'createdAt', + 'read' => 'read', + 'attachments' => 'attachments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'domain_id' => 'setDomainId', + 'subject' => 'setSubject', + 'to' => 'setTo', + 'from' => 'setFrom', + 'bcc' => 'setBcc', + 'cc' => 'setCc', + 'created_at' => 'setCreatedAt', + 'read' => 'setRead', + 'attachments' => 'setAttachments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'domain_id' => 'getDomainId', + 'subject' => 'getSubject', + 'to' => 'getTo', + 'from' => 'getFrom', + 'bcc' => 'getBcc', + 'cc' => 'getCc', + 'created_at' => 'getCreatedAt', + 'read' => 'getRead', + 'attachments' => 'getAttachments' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the email entity + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id ID of the domain that received the email + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject The subject line of the email message as specified by SMTP subject header + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from Who the email was sent from. An email address - see fromName for the sender name. + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When was the email received by MailSlurp + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks. + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension. + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailPreviewUrls.php b/lib/Models/EmailPreviewUrls.php new file mode 100644 index 00000000..308624f4 --- /dev/null +++ b/lib/Models/EmailPreviewUrls.php @@ -0,0 +1,455 @@ + + */ +class EmailPreviewUrls implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailPreviewUrls'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'raw_smtp_message_url' => 'string', + 'plain_html_body_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'raw_smtp_message_url' => null, + 'plain_html_body_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'raw_smtp_message_url' => false, + 'plain_html_body_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'raw_smtp_message_url' => 'rawSmtpMessageUrl', + 'plain_html_body_url' => 'plainHtmlBodyUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'raw_smtp_message_url' => 'setRawSmtpMessageUrl', + 'plain_html_body_url' => 'setPlainHtmlBodyUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'raw_smtp_message_url' => 'getRawSmtpMessageUrl', + 'plain_html_body_url' => 'getPlainHtmlBodyUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('raw_smtp_message_url', $data ?? [], null); + $this->setIfExists('plain_html_body_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['raw_smtp_message_url'] === null) { + $invalidProperties[] = "'raw_smtp_message_url' can't be null"; + } + if ($this->container['plain_html_body_url'] === null) { + $invalidProperties[] = "'plain_html_body_url' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets raw_smtp_message_url + * + * @return string + */ + public function getRawSmtpMessageUrl() + { + return $this->container['raw_smtp_message_url']; + } + + /** + * Sets raw_smtp_message_url + * + * @param string $raw_smtp_message_url raw_smtp_message_url + * + * @return self + */ + public function setRawSmtpMessageUrl($raw_smtp_message_url) + { + + if (is_null($raw_smtp_message_url)) { + throw new \InvalidArgumentException('non-nullable raw_smtp_message_url cannot be null'); + } + + $this->container['raw_smtp_message_url'] = $raw_smtp_message_url; + + return $this; + } + + /** + * Gets plain_html_body_url + * + * @return string + */ + public function getPlainHtmlBodyUrl() + { + return $this->container['plain_html_body_url']; + } + + /** + * Sets plain_html_body_url + * + * @param string $plain_html_body_url plain_html_body_url + * + * @return self + */ + public function setPlainHtmlBodyUrl($plain_html_body_url) + { + + if (is_null($plain_html_body_url)) { + throw new \InvalidArgumentException('non-nullable plain_html_body_url cannot be null'); + } + + $this->container['plain_html_body_url'] = $plain_html_body_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailProjection.php b/lib/Models/EmailProjection.php new file mode 100644 index 00000000..c2a51ec1 --- /dev/null +++ b/lib/Models/EmailProjection.php @@ -0,0 +1,955 @@ + + */ +class EmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'from' => 'string', + 'subject' => 'string', + 'inbox_id' => 'string', + 'created_at' => '\DateTime', + 'attachments' => 'string[]', + 'to' => 'string[]', + 'bcc' => 'string[]', + 'cc' => 'string[]', + 'domain_id' => 'string', + 'body_md5_hash' => 'string', + 'read' => 'bool', + 'body_excerpt' => 'string', + 'team_access' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'from' => null, + 'subject' => null, + 'inbox_id' => 'uuid', + 'created_at' => 'date-time', + 'attachments' => null, + 'to' => null, + 'bcc' => null, + 'cc' => null, + 'domain_id' => 'uuid', + 'body_md5_hash' => null, + 'read' => null, + 'body_excerpt' => null, + 'team_access' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from' => true, + 'subject' => true, + 'inbox_id' => false, + 'created_at' => false, + 'attachments' => true, + 'to' => false, + 'bcc' => true, + 'cc' => true, + 'domain_id' => true, + 'body_md5_hash' => true, + 'read' => false, + 'body_excerpt' => true, + 'team_access' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'from' => 'from', + 'subject' => 'subject', + 'inbox_id' => 'inboxId', + 'created_at' => 'createdAt', + 'attachments' => 'attachments', + 'to' => 'to', + 'bcc' => 'bcc', + 'cc' => 'cc', + 'domain_id' => 'domainId', + 'body_md5_hash' => 'bodyMD5Hash', + 'read' => 'read', + 'body_excerpt' => 'bodyExcerpt', + 'team_access' => 'teamAccess' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'from' => 'setFrom', + 'subject' => 'setSubject', + 'inbox_id' => 'setInboxId', + 'created_at' => 'setCreatedAt', + 'attachments' => 'setAttachments', + 'to' => 'setTo', + 'bcc' => 'setBcc', + 'cc' => 'setCc', + 'domain_id' => 'setDomainId', + 'body_md5_hash' => 'setBodyMd5Hash', + 'read' => 'setRead', + 'body_excerpt' => 'setBodyExcerpt', + 'team_access' => 'setTeamAccess' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'from' => 'getFrom', + 'subject' => 'getSubject', + 'inbox_id' => 'getInboxId', + 'created_at' => 'getCreatedAt', + 'attachments' => 'getAttachments', + 'to' => 'getTo', + 'bcc' => 'getBcc', + 'cc' => 'getCc', + 'domain_id' => 'getDomainId', + 'body_md5_hash' => 'getBodyMd5Hash', + 'read' => 'getRead', + 'body_excerpt' => 'getBodyExcerpt', + 'team_access' => 'getTeamAccess' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('body_md5_hash', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('body_excerpt', $data ?? [], null); + $this->setIfExists('team_access', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + if ($this->container['team_access'] === null) { + $invalidProperties[] = "'team_access' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from from + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments attachments + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc bcc + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc cc + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id domain_id + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets body_md5_hash + * + * @return string|null + */ + public function getBodyMd5Hash() + { + return $this->container['body_md5_hash']; + } + + /** + * Sets body_md5_hash + * + * @param string|null $body_md5_hash body_md5_hash + * + * @return self + */ + public function setBodyMd5Hash($body_md5_hash) + { + + if (is_null($body_md5_hash)) { + array_push($this->openAPINullablesSetToNull, 'body_md5_hash'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_md5_hash', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_md5_hash'] = $body_md5_hash; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read read + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + + /** + * Gets body_excerpt + * + * @return string|null + */ + public function getBodyExcerpt() + { + return $this->container['body_excerpt']; + } + + /** + * Sets body_excerpt + * + * @param string|null $body_excerpt body_excerpt + * + * @return self + */ + public function setBodyExcerpt($body_excerpt) + { + + if (is_null($body_excerpt)) { + array_push($this->openAPINullablesSetToNull, 'body_excerpt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_excerpt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_excerpt'] = $body_excerpt; + + return $this; + } + + /** + * Gets team_access + * + * @return bool + */ + public function getTeamAccess() + { + return $this->container['team_access']; + } + + /** + * Sets team_access + * + * @param bool $team_access team_access + * + * @return self + */ + public function setTeamAccess($team_access) + { + + if (is_null($team_access)) { + throw new \InvalidArgumentException('non-nullable team_access cannot be null'); + } + + $this->container['team_access'] = $team_access; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailRecipients.php b/lib/Models/EmailRecipients.php new file mode 100644 index 00000000..2cf210cd --- /dev/null +++ b/lib/Models/EmailRecipients.php @@ -0,0 +1,485 @@ + + */ +class EmailRecipients implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailRecipients'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to' => '\MailSlurp\Models\Recipient[]', + 'cc' => '\MailSlurp\Models\Recipient[]', + 'bcc' => '\MailSlurp\Models\Recipient[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to' => null, + 'cc' => null, + 'bcc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to' => false, + 'cc' => false, + 'bcc' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to' => 'to', + 'cc' => 'cc', + 'bcc' => 'bcc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to' => 'setTo', + 'cc' => 'setCc', + 'bcc' => 'setBcc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to' => 'getTo', + 'cc' => 'getCc', + 'bcc' => 'getBcc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return \MailSlurp\Models\Recipient[]|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \MailSlurp\Models\Recipient[]|null $to to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets cc + * + * @return \MailSlurp\Models\Recipient[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param \MailSlurp\Models\Recipient[]|null $cc cc + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return \MailSlurp\Models\Recipient[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param \MailSlurp\Models\Recipient[]|null $bcc bcc + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + } + + $this->container['bcc'] = $bcc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailTextLinesResult.php b/lib/Models/EmailTextLinesResult.php new file mode 100644 index 00000000..731e1874 --- /dev/null +++ b/lib/Models/EmailTextLinesResult.php @@ -0,0 +1,455 @@ + + */ +class EmailTextLinesResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailTextLinesResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'lines' => 'string[]', + 'body' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'lines' => null, + 'body' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'lines' => false, + 'body' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'lines' => 'lines', + 'body' => 'body' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'lines' => 'setLines', + 'body' => 'setBody' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'lines' => 'getLines', + 'body' => 'getBody' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('lines', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['lines'] === null) { + $invalidProperties[] = "'lines' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets lines + * + * @return string[] + */ + public function getLines() + { + return $this->container['lines']; + } + + /** + * Sets lines + * + * @param string[] $lines lines + * + * @return self + */ + public function setLines($lines) + { + + if (is_null($lines)) { + throw new \InvalidArgumentException('non-nullable lines cannot be null'); + } + + $this->container['lines'] = $lines; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailValidationRequestDto.php b/lib/Models/EmailValidationRequestDto.php new file mode 100644 index 00000000..36577458 --- /dev/null +++ b/lib/Models/EmailValidationRequestDto.php @@ -0,0 +1,611 @@ + + */ +class EmailValidationRequestDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailValidationRequestDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'email_address' => 'string', + 'is_valid' => 'bool', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'email_address' => null, + 'is_valid' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'email_address' => false, + 'is_valid' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'email_address' => 'emailAddress', + 'is_valid' => 'isValid', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'email_address' => 'setEmailAddress', + 'is_valid' => 'setIsValid', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'email_address' => 'getEmailAddress', + 'is_valid' => 'getIsValid', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('is_valid', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['is_valid'] === null) { + $invalidProperties[] = "'is_valid' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets is_valid + * + * @return bool + */ + public function getIsValid() + { + return $this->container['is_valid']; + } + + /** + * Sets is_valid + * + * @param bool $is_valid is_valid + * + * @return self + */ + public function setIsValid($is_valid) + { + + if (is_null($is_valid)) { + throw new \InvalidArgumentException('non-nullable is_valid cannot be null'); + } + + $this->container['is_valid'] = $is_valid; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmailVerificationResult.php b/lib/Models/EmailVerificationResult.php new file mode 100644 index 00000000..40f053aa --- /dev/null +++ b/lib/Models/EmailVerificationResult.php @@ -0,0 +1,576 @@ + + */ +class EmailVerificationResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmailVerificationResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'domain_name' => 'string', + 'port' => 'int', + 'email_address' => 'string', + 'is_valid' => 'bool', + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'domain_name' => null, + 'port' => 'int32', + 'email_address' => null, + 'is_valid' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'domain_name' => false, + 'port' => false, + 'email_address' => false, + 'is_valid' => false, + 'error' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'domain_name' => 'domainName', + 'port' => 'port', + 'email_address' => 'emailAddress', + 'is_valid' => 'isValid', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'domain_name' => 'setDomainName', + 'port' => 'setPort', + 'email_address' => 'setEmailAddress', + 'is_valid' => 'setIsValid', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'domain_name' => 'getDomainName', + 'port' => 'getPort', + 'email_address' => 'getEmailAddress', + 'is_valid' => 'getIsValid', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('domain_name', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('is_valid', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['domain_name'] === null) { + $invalidProperties[] = "'domain_name' can't be null"; + } + if ($this->container['port'] === null) { + $invalidProperties[] = "'port' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['is_valid'] === null) { + $invalidProperties[] = "'is_valid' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets domain_name + * + * @return string + */ + public function getDomainName() + { + return $this->container['domain_name']; + } + + /** + * Sets domain_name + * + * @param string $domain_name domain_name + * + * @return self + */ + public function setDomainName($domain_name) + { + + if (is_null($domain_name)) { + throw new \InvalidArgumentException('non-nullable domain_name cannot be null'); + } + + $this->container['domain_name'] = $domain_name; + + return $this; + } + + /** + * Gets port + * + * @return int + */ + public function getPort() + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param int $port port + * + * @return self + */ + public function setPort($port) + { + + if (is_null($port)) { + throw new \InvalidArgumentException('non-nullable port cannot be null'); + } + + $this->container['port'] = $port; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets is_valid + * + * @return bool + */ + public function getIsValid() + { + return $this->container['is_valid']; + } + + /** + * Sets is_valid + * + * @param bool $is_valid is_valid + * + * @return self + */ + public function setIsValid($is_valid) + { + + if (is_null($is_valid)) { + throw new \InvalidArgumentException('non-nullable is_valid cannot be null'); + } + + $this->container['is_valid'] = $is_valid; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return self + */ + public function setError($error) + { + + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmergencyAddress.php b/lib/Models/EmergencyAddress.php new file mode 100644 index 00000000..5a14dbdd --- /dev/null +++ b/lib/Models/EmergencyAddress.php @@ -0,0 +1,914 @@ + + */ +class EmergencyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmergencyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sid' => 'string', + 'user_id' => 'string', + 'display_name' => 'string', + 'customer_name' => 'string', + 'address1' => 'string', + 'city' => 'string', + 'region' => 'string', + 'postal_code' => 'string', + 'phone_country' => 'string', + 'account_sid' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'sid' => null, + 'user_id' => 'uuid', + 'display_name' => null, + 'customer_name' => null, + 'address1' => null, + 'city' => null, + 'region' => null, + 'postal_code' => null, + 'phone_country' => null, + 'account_sid' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'sid' => false, + 'user_id' => false, + 'display_name' => false, + 'customer_name' => false, + 'address1' => false, + 'city' => false, + 'region' => false, + 'postal_code' => false, + 'phone_country' => false, + 'account_sid' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'sid' => 'sid', + 'user_id' => 'userId', + 'display_name' => 'displayName', + 'customer_name' => 'customerName', + 'address1' => 'address1', + 'city' => 'city', + 'region' => 'region', + 'postal_code' => 'postalCode', + 'phone_country' => 'phoneCountry', + 'account_sid' => 'accountSid', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sid' => 'setSid', + 'user_id' => 'setUserId', + 'display_name' => 'setDisplayName', + 'customer_name' => 'setCustomerName', + 'address1' => 'setAddress1', + 'city' => 'setCity', + 'region' => 'setRegion', + 'postal_code' => 'setPostalCode', + 'phone_country' => 'setPhoneCountry', + 'account_sid' => 'setAccountSid', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sid' => 'getSid', + 'user_id' => 'getUserId', + 'display_name' => 'getDisplayName', + 'customer_name' => 'getCustomerName', + 'address1' => 'getAddress1', + 'city' => 'getCity', + 'region' => 'getRegion', + 'postal_code' => 'getPostalCode', + 'phone_country' => 'getPhoneCountry', + 'account_sid' => 'getAccountSid', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const PHONE_COUNTRY_US = 'US'; + public const PHONE_COUNTRY_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPhoneCountryAllowableValues() + { + return [ + self::PHONE_COUNTRY_US, + self::PHONE_COUNTRY_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sid', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('address1', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + $this->setIfExists('phone_country', $data ?? [], null); + $this->setIfExists('account_sid', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['sid'] === null) { + $invalidProperties[] = "'sid' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['display_name'] === null) { + $invalidProperties[] = "'display_name' can't be null"; + } + if ($this->container['customer_name'] === null) { + $invalidProperties[] = "'customer_name' can't be null"; + } + if ($this->container['address1'] === null) { + $invalidProperties[] = "'address1' can't be null"; + } + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ($this->container['region'] === null) { + $invalidProperties[] = "'region' can't be null"; + } + if ($this->container['postal_code'] === null) { + $invalidProperties[] = "'postal_code' can't be null"; + } + if ($this->container['phone_country'] === null) { + $invalidProperties[] = "'phone_country' can't be null"; + } + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'phone_country', must be one of '%s'", + $this->container['phone_country'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['account_sid'] === null) { + $invalidProperties[] = "'account_sid' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sid + * + * @return string + */ + public function getSid() + { + return $this->container['sid']; + } + + /** + * Sets sid + * + * @param string $sid sid + * + * @return self + */ + public function setSid($sid) + { + + if (is_null($sid)) { + throw new \InvalidArgumentException('non-nullable sid cannot be null'); + } + + $this->container['sid'] = $sid; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets display_name + * + * @return string + */ + public function getDisplayName() + { + return $this->container['display_name']; + } + + /** + * Sets display_name + * + * @param string $display_name display_name + * + * @return self + */ + public function setDisplayName($display_name) + { + + if (is_null($display_name)) { + throw new \InvalidArgumentException('non-nullable display_name cannot be null'); + } + + $this->container['display_name'] = $display_name; + + return $this; + } + + /** + * Gets customer_name + * + * @return string + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string $customer_name customer_name + * + * @return self + */ + public function setCustomerName($customer_name) + { + + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets address1 + * + * @return string + */ + public function getAddress1() + { + return $this->container['address1']; + } + + /** + * Sets address1 + * + * @param string $address1 address1 + * + * @return self + */ + public function setAddress1($address1) + { + + if (is_null($address1)) { + throw new \InvalidArgumentException('non-nullable address1 cannot be null'); + } + + $this->container['address1'] = $address1; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city city + * + * @return self + */ + public function setCity($city) + { + + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets region + * + * @return string + */ + public function getRegion() + { + return $this->container['region']; + } + + /** + * Sets region + * + * @param string $region region + * + * @return self + */ + public function setRegion($region) + { + + if (is_null($region)) { + throw new \InvalidArgumentException('non-nullable region cannot be null'); + } + + $this->container['region'] = $region; + + return $this; + } + + /** + * Gets postal_code + * + * @return string + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string $postal_code postal_code + * + * @return self + */ + public function setPostalCode($postal_code) + { + + if (is_null($postal_code)) { + throw new \InvalidArgumentException('non-nullable postal_code cannot be null'); + } + + $this->container['postal_code'] = $postal_code; + + return $this; + } + + /** + * Gets phone_country + * + * @return string + */ + public function getPhoneCountry() + { + return $this->container['phone_country']; + } + + /** + * Sets phone_country + * + * @param string $phone_country phone_country + * + * @return self + */ + public function setPhoneCountry($phone_country) + { + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!in_array($phone_country, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'phone_country', must be one of '%s'", + $phone_country, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($phone_country)) { + throw new \InvalidArgumentException('non-nullable phone_country cannot be null'); + } + + $this->container['phone_country'] = $phone_country; + + return $this; + } + + /** + * Gets account_sid + * + * @return string + */ + public function getAccountSid() + { + return $this->container['account_sid']; + } + + /** + * Sets account_sid + * + * @param string $account_sid account_sid + * + * @return self + */ + public function setAccountSid($account_sid) + { + + if (is_null($account_sid)) { + throw new \InvalidArgumentException('non-nullable account_sid cannot be null'); + } + + $this->container['account_sid'] = $account_sid; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmergencyAddressDto.php b/lib/Models/EmergencyAddressDto.php new file mode 100644 index 00000000..49f14419 --- /dev/null +++ b/lib/Models/EmergencyAddressDto.php @@ -0,0 +1,527 @@ + + */ +class EmergencyAddressDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmergencyAddressDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'address1' => 'string', + 'phone_country' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'address1' => null, + 'phone_country' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'address1' => false, + 'phone_country' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'address1' => 'address1', + 'phone_country' => 'phoneCountry' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'address1' => 'setAddress1', + 'phone_country' => 'setPhoneCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'address1' => 'getAddress1', + 'phone_country' => 'getPhoneCountry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const PHONE_COUNTRY_US = 'US'; + public const PHONE_COUNTRY_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPhoneCountryAllowableValues() + { + return [ + self::PHONE_COUNTRY_US, + self::PHONE_COUNTRY_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('address1', $data ?? [], null); + $this->setIfExists('phone_country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['address1'] === null) { + $invalidProperties[] = "'address1' can't be null"; + } + if ($this->container['phone_country'] === null) { + $invalidProperties[] = "'phone_country' can't be null"; + } + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'phone_country', must be one of '%s'", + $this->container['phone_country'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets address1 + * + * @return string + */ + public function getAddress1() + { + return $this->container['address1']; + } + + /** + * Sets address1 + * + * @param string $address1 address1 + * + * @return self + */ + public function setAddress1($address1) + { + + if (is_null($address1)) { + throw new \InvalidArgumentException('non-nullable address1 cannot be null'); + } + + $this->container['address1'] = $address1; + + return $this; + } + + /** + * Gets phone_country + * + * @return string + */ + public function getPhoneCountry() + { + return $this->container['phone_country']; + } + + /** + * Sets phone_country + * + * @param string $phone_country phone_country + * + * @return self + */ + public function setPhoneCountry($phone_country) + { + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!in_array($phone_country, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'phone_country', must be one of '%s'", + $phone_country, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($phone_country)) { + throw new \InvalidArgumentException('non-nullable phone_country cannot be null'); + } + + $this->container['phone_country'] = $phone_country; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/EmptyResponseDto.php b/lib/Models/EmptyResponseDto.php new file mode 100644 index 00000000..5d01dee9 --- /dev/null +++ b/lib/Models/EmptyResponseDto.php @@ -0,0 +1,412 @@ + + */ +class EmptyResponseDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EmptyResponseDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ExpirationDefaults.php b/lib/Models/ExpirationDefaults.php new file mode 100644 index 00000000..949ac181 --- /dev/null +++ b/lib/Models/ExpirationDefaults.php @@ -0,0 +1,584 @@ + + */ +class ExpirationDefaults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExpirationDefaults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'default_expiration_millis' => 'int', + 'max_expiration_millis' => 'int', + 'default_expires_at' => '\DateTime', + 'can_permanent_inbox' => 'bool', + 'next_inbox_allows_permanent' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'default_expiration_millis' => 'int64', + 'max_expiration_millis' => 'int64', + 'default_expires_at' => 'date-time', + 'can_permanent_inbox' => null, + 'next_inbox_allows_permanent' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'default_expiration_millis' => true, + 'max_expiration_millis' => true, + 'default_expires_at' => true, + 'can_permanent_inbox' => false, + 'next_inbox_allows_permanent' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'default_expiration_millis' => 'defaultExpirationMillis', + 'max_expiration_millis' => 'maxExpirationMillis', + 'default_expires_at' => 'defaultExpiresAt', + 'can_permanent_inbox' => 'canPermanentInbox', + 'next_inbox_allows_permanent' => 'nextInboxAllowsPermanent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'default_expiration_millis' => 'setDefaultExpirationMillis', + 'max_expiration_millis' => 'setMaxExpirationMillis', + 'default_expires_at' => 'setDefaultExpiresAt', + 'can_permanent_inbox' => 'setCanPermanentInbox', + 'next_inbox_allows_permanent' => 'setNextInboxAllowsPermanent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'default_expiration_millis' => 'getDefaultExpirationMillis', + 'max_expiration_millis' => 'getMaxExpirationMillis', + 'default_expires_at' => 'getDefaultExpiresAt', + 'can_permanent_inbox' => 'getCanPermanentInbox', + 'next_inbox_allows_permanent' => 'getNextInboxAllowsPermanent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('default_expiration_millis', $data ?? [], null); + $this->setIfExists('max_expiration_millis', $data ?? [], null); + $this->setIfExists('default_expires_at', $data ?? [], null); + $this->setIfExists('can_permanent_inbox', $data ?? [], null); + $this->setIfExists('next_inbox_allows_permanent', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['can_permanent_inbox'] === null) { + $invalidProperties[] = "'can_permanent_inbox' can't be null"; + } + if ($this->container['next_inbox_allows_permanent'] === null) { + $invalidProperties[] = "'next_inbox_allows_permanent' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets default_expiration_millis + * + * @return int|null + */ + public function getDefaultExpirationMillis() + { + return $this->container['default_expiration_millis']; + } + + /** + * Sets default_expiration_millis + * + * @param int|null $default_expiration_millis default_expiration_millis + * + * @return self + */ + public function setDefaultExpirationMillis($default_expiration_millis) + { + + if (is_null($default_expiration_millis)) { + array_push($this->openAPINullablesSetToNull, 'default_expiration_millis'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('default_expiration_millis', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['default_expiration_millis'] = $default_expiration_millis; + + return $this; + } + + /** + * Gets max_expiration_millis + * + * @return int|null + */ + public function getMaxExpirationMillis() + { + return $this->container['max_expiration_millis']; + } + + /** + * Sets max_expiration_millis + * + * @param int|null $max_expiration_millis max_expiration_millis + * + * @return self + */ + public function setMaxExpirationMillis($max_expiration_millis) + { + + if (is_null($max_expiration_millis)) { + array_push($this->openAPINullablesSetToNull, 'max_expiration_millis'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_expiration_millis', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['max_expiration_millis'] = $max_expiration_millis; + + return $this; + } + + /** + * Gets default_expires_at + * + * @return \DateTime|null + */ + public function getDefaultExpiresAt() + { + return $this->container['default_expires_at']; + } + + /** + * Sets default_expires_at + * + * @param \DateTime|null $default_expires_at default_expires_at + * + * @return self + */ + public function setDefaultExpiresAt($default_expires_at) + { + + if (is_null($default_expires_at)) { + array_push($this->openAPINullablesSetToNull, 'default_expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('default_expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['default_expires_at'] = $default_expires_at; + + return $this; + } + + /** + * Gets can_permanent_inbox + * + * @return bool + */ + public function getCanPermanentInbox() + { + return $this->container['can_permanent_inbox']; + } + + /** + * Sets can_permanent_inbox + * + * @param bool $can_permanent_inbox can_permanent_inbox + * + * @return self + */ + public function setCanPermanentInbox($can_permanent_inbox) + { + + if (is_null($can_permanent_inbox)) { + throw new \InvalidArgumentException('non-nullable can_permanent_inbox cannot be null'); + } + + $this->container['can_permanent_inbox'] = $can_permanent_inbox; + + return $this; + } + + /** + * Gets next_inbox_allows_permanent + * + * @return bool + */ + public function getNextInboxAllowsPermanent() + { + return $this->container['next_inbox_allows_permanent']; + } + + /** + * Sets next_inbox_allows_permanent + * + * @param bool $next_inbox_allows_permanent next_inbox_allows_permanent + * + * @return self + */ + public function setNextInboxAllowsPermanent($next_inbox_allows_permanent) + { + + if (is_null($next_inbox_allows_permanent)) { + throw new \InvalidArgumentException('non-nullable next_inbox_allows_permanent cannot be null'); + } + + $this->container['next_inbox_allows_permanent'] = $next_inbox_allows_permanent; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ExpiredInboxDto.php b/lib/Models/ExpiredInboxDto.php new file mode 100644 index 00000000..8f2987d7 --- /dev/null +++ b/lib/Models/ExpiredInboxDto.php @@ -0,0 +1,494 @@ + + */ +class ExpiredInboxDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExpiredInboxDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'inbox_id' => 'string', + 'email_address' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'inbox_id' => 'uuid', + 'email_address' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'inbox_id' => false, + 'email_address' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'inbox_id' => 'inboxId', + 'email_address' => 'emailAddress' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'inbox_id' => 'setInboxId', + 'email_address' => 'setEmailAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'inbox_id' => 'getInboxId', + 'email_address' => 'getEmailAddress' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ExpiredInboxRecordProjection.php b/lib/Models/ExpiredInboxRecordProjection.php new file mode 100644 index 00000000..eeb57cc4 --- /dev/null +++ b/lib/Models/ExpiredInboxRecordProjection.php @@ -0,0 +1,533 @@ + + */ +class ExpiredInboxRecordProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExpiredInboxRecordProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'email_address' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'email_address' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'email_address' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'email_address' => 'emailAddress', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'email_address' => 'setEmailAddress', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'email_address' => 'getEmailAddress', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ExportLink.php b/lib/Models/ExportLink.php new file mode 100644 index 00000000..0170c80f --- /dev/null +++ b/lib/Models/ExportLink.php @@ -0,0 +1,416 @@ + + */ +class ExportLink implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportLink'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'download_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'download_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'download_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'download_link' => 'downloadLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'download_link' => 'setDownloadLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'download_link' => 'getDownloadLink' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('download_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['download_link'] === null) { + $invalidProperties[] = "'download_link' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets download_link + * + * @return string + */ + public function getDownloadLink() + { + return $this->container['download_link']; + } + + /** + * Sets download_link + * + * @param string $download_link download_link + * + * @return self + */ + public function setDownloadLink($download_link) + { + + if (is_null($download_link)) { + throw new \InvalidArgumentException('non-nullable download_link cannot be null'); + } + + $this->container['download_link'] = $download_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ExportOptions.php b/lib/Models/ExportOptions.php new file mode 100644 index 00000000..d4276ef3 --- /dev/null +++ b/lib/Models/ExportOptions.php @@ -0,0 +1,665 @@ + + */ +class ExportOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'output_format' => 'string', + 'exclude_previously_exported' => 'bool', + 'created_earliest_time' => '\DateTime', + 'created_oldest_time' => '\DateTime', + 'filter' => 'string', + 'list_separator_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'output_format' => null, + 'exclude_previously_exported' => null, + 'created_earliest_time' => 'date-time', + 'created_oldest_time' => 'date-time', + 'filter' => null, + 'list_separator_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'output_format' => false, + 'exclude_previously_exported' => true, + 'created_earliest_time' => true, + 'created_oldest_time' => true, + 'filter' => true, + 'list_separator_token' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'output_format' => 'outputFormat', + 'exclude_previously_exported' => 'excludePreviouslyExported', + 'created_earliest_time' => 'createdEarliestTime', + 'created_oldest_time' => 'createdOldestTime', + 'filter' => 'filter', + 'list_separator_token' => 'listSeparatorToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'output_format' => 'setOutputFormat', + 'exclude_previously_exported' => 'setExcludePreviouslyExported', + 'created_earliest_time' => 'setCreatedEarliestTime', + 'created_oldest_time' => 'setCreatedOldestTime', + 'filter' => 'setFilter', + 'list_separator_token' => 'setListSeparatorToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'output_format' => 'getOutputFormat', + 'exclude_previously_exported' => 'getExcludePreviouslyExported', + 'created_earliest_time' => 'getCreatedEarliestTime', + 'created_oldest_time' => 'getCreatedOldestTime', + 'filter' => 'getFilter', + 'list_separator_token' => 'getListSeparatorToken' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const OUTPUT_FORMAT__DEFAULT = 'CSV_DEFAULT'; + public const OUTPUT_FORMAT_EXCEL = 'CSV_EXCEL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOutputFormatAllowableValues() + { + return [ + self::OUTPUT_FORMAT__DEFAULT, + self::OUTPUT_FORMAT_EXCEL, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('output_format', $data ?? [], null); + $this->setIfExists('exclude_previously_exported', $data ?? [], null); + $this->setIfExists('created_earliest_time', $data ?? [], null); + $this->setIfExists('created_oldest_time', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('list_separator_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['output_format'] === null) { + $invalidProperties[] = "'output_format' can't be null"; + } + $allowedValues = $this->getOutputFormatAllowableValues(); + if (!is_null($this->container['output_format']) && !in_array($this->container['output_format'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'output_format', must be one of '%s'", + $this->container['output_format'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets output_format + * + * @return string + */ + public function getOutputFormat() + { + return $this->container['output_format']; + } + + /** + * Sets output_format + * + * @param string $output_format output_format + * + * @return self + */ + public function setOutputFormat($output_format) + { + $allowedValues = $this->getOutputFormatAllowableValues(); + if (!in_array($output_format, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'output_format', must be one of '%s'", + $output_format, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($output_format)) { + throw new \InvalidArgumentException('non-nullable output_format cannot be null'); + } + + $this->container['output_format'] = $output_format; + + return $this; + } + + /** + * Gets exclude_previously_exported + * + * @return bool|null + */ + public function getExcludePreviouslyExported() + { + return $this->container['exclude_previously_exported']; + } + + /** + * Sets exclude_previously_exported + * + * @param bool|null $exclude_previously_exported exclude_previously_exported + * + * @return self + */ + public function setExcludePreviouslyExported($exclude_previously_exported) + { + + if (is_null($exclude_previously_exported)) { + array_push($this->openAPINullablesSetToNull, 'exclude_previously_exported'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exclude_previously_exported', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['exclude_previously_exported'] = $exclude_previously_exported; + + return $this; + } + + /** + * Gets created_earliest_time + * + * @return \DateTime|null + */ + public function getCreatedEarliestTime() + { + return $this->container['created_earliest_time']; + } + + /** + * Sets created_earliest_time + * + * @param \DateTime|null $created_earliest_time created_earliest_time + * + * @return self + */ + public function setCreatedEarliestTime($created_earliest_time) + { + + if (is_null($created_earliest_time)) { + array_push($this->openAPINullablesSetToNull, 'created_earliest_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('created_earliest_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['created_earliest_time'] = $created_earliest_time; + + return $this; + } + + /** + * Gets created_oldest_time + * + * @return \DateTime|null + */ + public function getCreatedOldestTime() + { + return $this->container['created_oldest_time']; + } + + /** + * Sets created_oldest_time + * + * @param \DateTime|null $created_oldest_time created_oldest_time + * + * @return self + */ + public function setCreatedOldestTime($created_oldest_time) + { + + if (is_null($created_oldest_time)) { + array_push($this->openAPINullablesSetToNull, 'created_oldest_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('created_oldest_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['created_oldest_time'] = $created_oldest_time; + + return $this; + } + + /** + * Gets filter + * + * @return string|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param string|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets list_separator_token + * + * @return string|null + */ + public function getListSeparatorToken() + { + return $this->container['list_separator_token']; + } + + /** + * Sets list_separator_token + * + * @param string|null $list_separator_token list_separator_token + * + * @return self + */ + public function setListSeparatorToken($list_separator_token) + { + + if (is_null($list_separator_token)) { + array_push($this->openAPINullablesSetToNull, 'list_separator_token'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('list_separator_token', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['list_separator_token'] = $list_separator_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/FilterBouncedRecipientsOptions.php b/lib/Models/FilterBouncedRecipientsOptions.php new file mode 100644 index 00000000..40a65baf --- /dev/null +++ b/lib/Models/FilterBouncedRecipientsOptions.php @@ -0,0 +1,416 @@ + + */ +class FilterBouncedRecipientsOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FilterBouncedRecipientsOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_recipients' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_recipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_recipients' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_recipients' => 'emailRecipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_recipients' => 'setEmailRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_recipients' => 'getEmailRecipients' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_recipients', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_recipients'] === null) { + $invalidProperties[] = "'email_recipients' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_recipients + * + * @return string[] + */ + public function getEmailRecipients() + { + return $this->container['email_recipients']; + } + + /** + * Sets email_recipients + * + * @param string[] $email_recipients email_recipients + * + * @return self + */ + public function setEmailRecipients($email_recipients) + { + + if (is_null($email_recipients)) { + throw new \InvalidArgumentException('non-nullable email_recipients cannot be null'); + } + + $this->container['email_recipients'] = $email_recipients; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/FilterBouncedRecipientsResult.php b/lib/Models/FilterBouncedRecipientsResult.php new file mode 100644 index 00000000..4ed43139 --- /dev/null +++ b/lib/Models/FilterBouncedRecipientsResult.php @@ -0,0 +1,416 @@ + + */ +class FilterBouncedRecipientsResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FilterBouncedRecipientsResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filtered_recipients' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filtered_recipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filtered_recipients' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'filtered_recipients' => 'filteredRecipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filtered_recipients' => 'setFilteredRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filtered_recipients' => 'getFilteredRecipients' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('filtered_recipients', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['filtered_recipients'] === null) { + $invalidProperties[] = "'filtered_recipients' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets filtered_recipients + * + * @return string[] + */ + public function getFilteredRecipients() + { + return $this->container['filtered_recipients']; + } + + /** + * Sets filtered_recipients + * + * @param string[] $filtered_recipients filtered_recipients + * + * @return self + */ + public function setFilteredRecipients($filtered_recipients) + { + + if (is_null($filtered_recipients)) { + throw new \InvalidArgumentException('non-nullable filtered_recipients cannot be null'); + } + + $this->container['filtered_recipients'] = $filtered_recipients; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/FlushExpiredInboxesResult.php b/lib/Models/FlushExpiredInboxesResult.php new file mode 100644 index 00000000..60ecb8b7 --- /dev/null +++ b/lib/Models/FlushExpiredInboxesResult.php @@ -0,0 +1,455 @@ + + */ +class FlushExpiredInboxesResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FlushExpiredInboxesResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_ids' => 'string[]', + 'expire_before' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_ids' => 'uuid', + 'expire_before' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_ids' => false, + 'expire_before' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_ids' => 'inboxIds', + 'expire_before' => 'expireBefore' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_ids' => 'setInboxIds', + 'expire_before' => 'setExpireBefore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_ids' => 'getInboxIds', + 'expire_before' => 'getExpireBefore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_ids', $data ?? [], null); + $this->setIfExists('expire_before', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_ids'] === null) { + $invalidProperties[] = "'inbox_ids' can't be null"; + } + if ($this->container['expire_before'] === null) { + $invalidProperties[] = "'expire_before' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_ids + * + * @return string[] + */ + public function getInboxIds() + { + return $this->container['inbox_ids']; + } + + /** + * Sets inbox_ids + * + * @param string[] $inbox_ids Inbox IDs affected by expiration + * + * @return self + */ + public function setInboxIds($inbox_ids) + { + + if (is_null($inbox_ids)) { + throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null'); + } + + $this->container['inbox_ids'] = $inbox_ids; + + return $this; + } + + /** + * Gets expire_before + * + * @return \DateTime + */ + public function getExpireBefore() + { + return $this->container['expire_before']; + } + + /** + * Sets expire_before + * + * @param \DateTime $expire_before DateTime to filter inboxes so that those expiring before this time are expired + * + * @return self + */ + public function setExpireBefore($expire_before) + { + + if (is_null($expire_before)) { + throw new \InvalidArgumentException('non-nullable expire_before cannot be null'); + } + + $this->container['expire_before'] = $expire_before; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ForwardEmailOptions.php b/lib/Models/ForwardEmailOptions.php new file mode 100644 index 00000000..edfe08e8 --- /dev/null +++ b/lib/Models/ForwardEmailOptions.php @@ -0,0 +1,674 @@ + + */ +class ForwardEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForwardEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to' => 'string[]', + 'subject' => 'string', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'from' => 'string', + 'use_inbox_name' => 'bool', + 'filter_bounced_recipients' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to' => null, + 'subject' => null, + 'cc' => null, + 'bcc' => null, + 'from' => null, + 'use_inbox_name' => null, + 'filter_bounced_recipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to' => false, + 'subject' => true, + 'cc' => true, + 'bcc' => true, + 'from' => true, + 'use_inbox_name' => true, + 'filter_bounced_recipients' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to' => 'to', + 'subject' => 'subject', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'from' => 'from', + 'use_inbox_name' => 'useInboxName', + 'filter_bounced_recipients' => 'filterBouncedRecipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to' => 'setTo', + 'subject' => 'setSubject', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'from' => 'setFrom', + 'use_inbox_name' => 'setUseInboxName', + 'filter_bounced_recipients' => 'setFilterBouncedRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to' => 'getTo', + 'subject' => 'getSubject', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'from' => 'getFrom', + 'use_inbox_name' => 'getUseInboxName', + 'filter_bounced_recipients' => 'getFilterBouncedRecipients' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('use_inbox_name', $data ?? [], null); + $this->setIfExists('filter_bounced_recipients', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to To recipients for forwarded email + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Subject for forwarded email + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc Optional cc recipients + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc Optional bcc recipients + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from Optional from override + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets use_inbox_name + * + * @return bool|null + */ + public function getUseInboxName() + { + return $this->container['use_inbox_name']; + } + + /** + * Sets use_inbox_name + * + * @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address + * + * @return self + */ + public function setUseInboxName($use_inbox_name) + { + + if (is_null($use_inbox_name)) { + array_push($this->openAPINullablesSetToNull, 'use_inbox_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_inbox_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_inbox_name'] = $use_inbox_name; + + return $this; + } + + /** + * Gets filter_bounced_recipients + * + * @return bool|null + */ + public function getFilterBouncedRecipients() + { + return $this->container['filter_bounced_recipients']; + } + + /** + * Sets filter_bounced_recipients + * + * @param bool|null $filter_bounced_recipients Filter recipients to remove any bounced recipients from to, bcc, and cc before sending + * + * @return self + */ + public function setFilterBouncedRecipients($filter_bounced_recipients) + { + + if (is_null($filter_bounced_recipients)) { + array_push($this->openAPINullablesSetToNull, 'filter_bounced_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter_bounced_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['filter_bounced_recipients'] = $filter_bounced_recipients; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/GravatarUrl.php b/lib/Models/GravatarUrl.php new file mode 100644 index 00000000..b486311c --- /dev/null +++ b/lib/Models/GravatarUrl.php @@ -0,0 +1,455 @@ + + */ +class GravatarUrl implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GravatarUrl'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string', + 'hash' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null, + 'hash' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => false, + 'hash' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'url' => 'url', + 'hash' => 'hash' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl', + 'hash' => 'setHash' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl', + 'hash' => 'getHash' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('hash', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['hash'] === null) { + $invalidProperties[] = "'hash' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url url + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets hash + * + * @return string + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string $hash hash + * + * @return self + */ + public function setHash($hash) + { + + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + + $this->container['hash'] = $hash; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/GroupContactsDto.php b/lib/Models/GroupContactsDto.php new file mode 100644 index 00000000..f4ed0fd7 --- /dev/null +++ b/lib/Models/GroupContactsDto.php @@ -0,0 +1,455 @@ + + */ +class GroupContactsDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupContactsDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'group' => '\MailSlurp\Models\GroupDto', + 'contacts' => '\MailSlurp\Models\ContactDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'group' => null, + 'contacts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group' => false, + 'contacts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'group' => 'group', + 'contacts' => 'contacts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'group' => 'setGroup', + 'contacts' => 'setContacts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'group' => 'getGroup', + 'contacts' => 'getContacts' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('contacts', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['group'] === null) { + $invalidProperties[] = "'group' can't be null"; + } + if ($this->container['contacts'] === null) { + $invalidProperties[] = "'contacts' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets group + * + * @return \MailSlurp\Models\GroupDto + */ + public function getGroup() + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param \MailSlurp\Models\GroupDto $group group + * + * @return self + */ + public function setGroup($group) + { + + if (is_null($group)) { + throw new \InvalidArgumentException('non-nullable group cannot be null'); + } + + $this->container['group'] = $group; + + return $this; + } + + /** + * Gets contacts + * + * @return \MailSlurp\Models\ContactDto[] + */ + public function getContacts() + { + return $this->container['contacts']; + } + + /** + * Sets contacts + * + * @param \MailSlurp\Models\ContactDto[] $contacts contacts + * + * @return self + */ + public function setContacts($contacts) + { + + if (is_null($contacts)) { + throw new \InvalidArgumentException('non-nullable contacts cannot be null'); + } + + $this->container['contacts'] = $contacts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/GroupDto.php b/lib/Models/GroupDto.php new file mode 100644 index 00000000..76299639 --- /dev/null +++ b/lib/Models/GroupDto.php @@ -0,0 +1,537 @@ + + */ +class GroupDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'name' => null, + 'description' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'description' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/GroupProjection.php b/lib/Models/GroupProjection.php new file mode 100644 index 00000000..c1dcf4f1 --- /dev/null +++ b/lib/Models/GroupProjection.php @@ -0,0 +1,537 @@ + + */ +class GroupProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'description' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'description' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'description' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'description' => 'description', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'description' => 'setDescription', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'description' => 'getDescription', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/HTMLValidationResult.php b/lib/Models/HTMLValidationResult.php new file mode 100644 index 00000000..bb583cfd --- /dev/null +++ b/lib/Models/HTMLValidationResult.php @@ -0,0 +1,494 @@ + + */ +class HTMLValidationResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'HTMLValidationResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is_valid' => 'bool', + 'errors' => '\MailSlurp\Models\ValidationMessage[]', + 'warnings' => '\MailSlurp\Models\ValidationMessage[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is_valid' => null, + 'errors' => null, + 'warnings' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_valid' => false, + 'errors' => false, + 'warnings' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is_valid' => 'isValid', + 'errors' => 'errors', + 'warnings' => 'warnings' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_valid' => 'setIsValid', + 'errors' => 'setErrors', + 'warnings' => 'setWarnings' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_valid' => 'getIsValid', + 'errors' => 'getErrors', + 'warnings' => 'getWarnings' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('is_valid', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['is_valid'] === null) { + $invalidProperties[] = "'is_valid' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['warnings'] === null) { + $invalidProperties[] = "'warnings' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_valid + * + * @return bool + */ + public function getIsValid() + { + return $this->container['is_valid']; + } + + /** + * Sets is_valid + * + * @param bool $is_valid Is HTML validation result valid + * + * @return self + */ + public function setIsValid($is_valid) + { + + if (is_null($is_valid)) { + throw new \InvalidArgumentException('non-nullable is_valid cannot be null'); + } + + $this->container['is_valid'] = $is_valid; + + return $this; + } + + /** + * Gets errors + * + * @return \MailSlurp\Models\ValidationMessage[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \MailSlurp\Models\ValidationMessage[] $errors Optional errors resulting from HTML validation + * + * @return self + */ + public function setErrors($errors) + { + + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets warnings + * + * @return \MailSlurp\Models\ValidationMessage[] + */ + public function getWarnings() + { + return $this->container['warnings']; + } + + /** + * Sets warnings + * + * @param \MailSlurp\Models\ValidationMessage[] $warnings Optional warnings resulting from HTML validation + * + * @return self + */ + public function setWarnings($warnings) + { + + if (is_null($warnings)) { + throw new \InvalidArgumentException('non-nullable warnings cannot be null'); + } + + $this->container['warnings'] = $warnings; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/IPAddressResult.php b/lib/Models/IPAddressResult.php new file mode 100644 index 00000000..5ab86b9f --- /dev/null +++ b/lib/Models/IPAddressResult.php @@ -0,0 +1,455 @@ + + */ +class IPAddressResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'IPAddressResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address' => 'string', + 'hostname' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'hostname' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'address' => false, + 'hostname' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'hostname' => 'hostname' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'hostname' => 'setHostname' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'hostname' => 'getHostname' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('hostname', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + if ($this->container['hostname'] === null) { + $invalidProperties[] = "'hostname' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return string + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string $address address + * + * @return self + */ + public function setAddress($address) + { + + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets hostname + * + * @return string + */ + public function getHostname() + { + return $this->container['hostname']; + } + + /** + * Sets hostname + * + * @param string $hostname hostname + * + * @return self + */ + public function setHostname($hostname) + { + + if (is_null($hostname)) { + throw new \InvalidArgumentException('non-nullable hostname cannot be null'); + } + + $this->container['hostname'] = $hostname; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ImapFlagOperationOptions.php b/lib/Models/ImapFlagOperationOptions.php new file mode 100644 index 00000000..d56ab382 --- /dev/null +++ b/lib/Models/ImapFlagOperationOptions.php @@ -0,0 +1,491 @@ + + */ +class ImapFlagOperationOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ImapFlagOperationOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'flag_operation' => 'string', + 'flags' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'flag_operation' => null, + 'flags' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'flag_operation' => false, + 'flags' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'flag_operation' => 'flagOperation', + 'flags' => 'flags' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'flag_operation' => 'setFlagOperation', + 'flags' => 'setFlags' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'flag_operation' => 'getFlagOperation', + 'flags' => 'getFlags' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const FLAG_OPERATION_SET_FLAGS = 'SET_FLAGS'; + public const FLAG_OPERATION_ADD_FLAGS = 'ADD_FLAGS'; + public const FLAG_OPERATION_REMOVE_FLAGS = 'REMOVE_FLAGS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFlagOperationAllowableValues() + { + return [ + self::FLAG_OPERATION_SET_FLAGS, + self::FLAG_OPERATION_ADD_FLAGS, + self::FLAG_OPERATION_REMOVE_FLAGS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('flag_operation', $data ?? [], null); + $this->setIfExists('flags', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['flag_operation'] === null) { + $invalidProperties[] = "'flag_operation' can't be null"; + } + $allowedValues = $this->getFlagOperationAllowableValues(); + if (!is_null($this->container['flag_operation']) && !in_array($this->container['flag_operation'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'flag_operation', must be one of '%s'", + $this->container['flag_operation'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['flags'] === null) { + $invalidProperties[] = "'flags' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets flag_operation + * + * @return string + */ + public function getFlagOperation() + { + return $this->container['flag_operation']; + } + + /** + * Sets flag_operation + * + * @param string $flag_operation flag_operation + * + * @return self + */ + public function setFlagOperation($flag_operation) + { + $allowedValues = $this->getFlagOperationAllowableValues(); + if (!in_array($flag_operation, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'flag_operation', must be one of '%s'", + $flag_operation, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($flag_operation)) { + throw new \InvalidArgumentException('non-nullable flag_operation cannot be null'); + } + + $this->container['flag_operation'] = $flag_operation; + + return $this; + } + + /** + * Gets flags + * + * @return string[] + */ + public function getFlags() + { + return $this->container['flags']; + } + + /** + * Sets flags + * + * @param string[] $flags flags + * + * @return self + */ + public function setFlags($flags) + { + + if (is_null($flags)) { + throw new \InvalidArgumentException('non-nullable flags cannot be null'); + } + + $this->container['flags'] = $flags; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ImapSmtpAccessDetails.php b/lib/Models/ImapSmtpAccessDetails.php new file mode 100644 index 00000000..7ba7417f --- /dev/null +++ b/lib/Models/ImapSmtpAccessDetails.php @@ -0,0 +1,689 @@ + + */ +class ImapSmtpAccessDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ImapSmtpAccessDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'smtp_server_host' => 'string', + 'smtp_server_port' => 'int', + 'smtp_username' => 'string', + 'smtp_password' => 'string', + 'imap_server_host' => 'string', + 'imap_server_port' => 'int', + 'imap_username' => 'string', + 'imap_password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'smtp_server_host' => null, + 'smtp_server_port' => 'int32', + 'smtp_username' => null, + 'smtp_password' => null, + 'imap_server_host' => null, + 'imap_server_port' => 'int32', + 'imap_username' => null, + 'imap_password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'smtp_server_host' => false, + 'smtp_server_port' => false, + 'smtp_username' => false, + 'smtp_password' => false, + 'imap_server_host' => false, + 'imap_server_port' => false, + 'imap_username' => false, + 'imap_password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'smtp_server_host' => 'smtpServerHost', + 'smtp_server_port' => 'smtpServerPort', + 'smtp_username' => 'smtpUsername', + 'smtp_password' => 'smtpPassword', + 'imap_server_host' => 'imapServerHost', + 'imap_server_port' => 'imapServerPort', + 'imap_username' => 'imapUsername', + 'imap_password' => 'imapPassword' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'smtp_server_host' => 'setSmtpServerHost', + 'smtp_server_port' => 'setSmtpServerPort', + 'smtp_username' => 'setSmtpUsername', + 'smtp_password' => 'setSmtpPassword', + 'imap_server_host' => 'setImapServerHost', + 'imap_server_port' => 'setImapServerPort', + 'imap_username' => 'setImapUsername', + 'imap_password' => 'setImapPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'smtp_server_host' => 'getSmtpServerHost', + 'smtp_server_port' => 'getSmtpServerPort', + 'smtp_username' => 'getSmtpUsername', + 'smtp_password' => 'getSmtpPassword', + 'imap_server_host' => 'getImapServerHost', + 'imap_server_port' => 'getImapServerPort', + 'imap_username' => 'getImapUsername', + 'imap_password' => 'getImapPassword' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('smtp_server_host', $data ?? [], null); + $this->setIfExists('smtp_server_port', $data ?? [], null); + $this->setIfExists('smtp_username', $data ?? [], null); + $this->setIfExists('smtp_password', $data ?? [], null); + $this->setIfExists('imap_server_host', $data ?? [], null); + $this->setIfExists('imap_server_port', $data ?? [], null); + $this->setIfExists('imap_username', $data ?? [], null); + $this->setIfExists('imap_password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['smtp_server_host'] === null) { + $invalidProperties[] = "'smtp_server_host' can't be null"; + } + if ($this->container['smtp_server_port'] === null) { + $invalidProperties[] = "'smtp_server_port' can't be null"; + } + if ($this->container['smtp_username'] === null) { + $invalidProperties[] = "'smtp_username' can't be null"; + } + if ($this->container['smtp_password'] === null) { + $invalidProperties[] = "'smtp_password' can't be null"; + } + if ($this->container['imap_server_host'] === null) { + $invalidProperties[] = "'imap_server_host' can't be null"; + } + if ($this->container['imap_server_port'] === null) { + $invalidProperties[] = "'imap_server_port' can't be null"; + } + if ($this->container['imap_username'] === null) { + $invalidProperties[] = "'imap_username' can't be null"; + } + if ($this->container['imap_password'] === null) { + $invalidProperties[] = "'imap_password' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets smtp_server_host + * + * @return string + */ + public function getSmtpServerHost() + { + return $this->container['smtp_server_host']; + } + + /** + * Sets smtp_server_host + * + * @param string $smtp_server_host SMTP server host domain + * + * @return self + */ + public function setSmtpServerHost($smtp_server_host) + { + + if (is_null($smtp_server_host)) { + throw new \InvalidArgumentException('non-nullable smtp_server_host cannot be null'); + } + + $this->container['smtp_server_host'] = $smtp_server_host; + + return $this; + } + + /** + * Gets smtp_server_port + * + * @return int + */ + public function getSmtpServerPort() + { + return $this->container['smtp_server_port']; + } + + /** + * Sets smtp_server_port + * + * @param int $smtp_server_port SMTP server host port + * + * @return self + */ + public function setSmtpServerPort($smtp_server_port) + { + + if (is_null($smtp_server_port)) { + throw new \InvalidArgumentException('non-nullable smtp_server_port cannot be null'); + } + + $this->container['smtp_server_port'] = $smtp_server_port; + + return $this; + } + + /** + * Gets smtp_username + * + * @return string + */ + public function getSmtpUsername() + { + return $this->container['smtp_username']; + } + + /** + * Sets smtp_username + * + * @param string $smtp_username SMTP username for login + * + * @return self + */ + public function setSmtpUsername($smtp_username) + { + + if (is_null($smtp_username)) { + throw new \InvalidArgumentException('non-nullable smtp_username cannot be null'); + } + + $this->container['smtp_username'] = $smtp_username; + + return $this; + } + + /** + * Gets smtp_password + * + * @return string + */ + public function getSmtpPassword() + { + return $this->container['smtp_password']; + } + + /** + * Sets smtp_password + * + * @param string $smtp_password SMTP for login + * + * @return self + */ + public function setSmtpPassword($smtp_password) + { + + if (is_null($smtp_password)) { + throw new \InvalidArgumentException('non-nullable smtp_password cannot be null'); + } + + $this->container['smtp_password'] = $smtp_password; + + return $this; + } + + /** + * Gets imap_server_host + * + * @return string + */ + public function getImapServerHost() + { + return $this->container['imap_server_host']; + } + + /** + * Sets imap_server_host + * + * @param string $imap_server_host IMAP server host domain + * + * @return self + */ + public function setImapServerHost($imap_server_host) + { + + if (is_null($imap_server_host)) { + throw new \InvalidArgumentException('non-nullable imap_server_host cannot be null'); + } + + $this->container['imap_server_host'] = $imap_server_host; + + return $this; + } + + /** + * Gets imap_server_port + * + * @return int + */ + public function getImapServerPort() + { + return $this->container['imap_server_port']; + } + + /** + * Sets imap_server_port + * + * @param int $imap_server_port IMAP server host port + * + * @return self + */ + public function setImapServerPort($imap_server_port) + { + + if (is_null($imap_server_port)) { + throw new \InvalidArgumentException('non-nullable imap_server_port cannot be null'); + } + + $this->container['imap_server_port'] = $imap_server_port; + + return $this; + } + + /** + * Gets imap_username + * + * @return string + */ + public function getImapUsername() + { + return $this->container['imap_username']; + } + + /** + * Sets imap_username + * + * @param string $imap_username IMAP username for login + * + * @return self + */ + public function setImapUsername($imap_username) + { + + if (is_null($imap_username)) { + throw new \InvalidArgumentException('non-nullable imap_username cannot be null'); + } + + $this->container['imap_username'] = $imap_username; + + return $this; + } + + /** + * Gets imap_password + * + * @return string + */ + public function getImapPassword() + { + return $this->container['imap_password']; + } + + /** + * Sets imap_password + * + * @param string $imap_password IMAP password for login + * + * @return self + */ + public function setImapPassword($imap_password) + { + + if (is_null($imap_password)) { + throw new \InvalidArgumentException('non-nullable imap_password cannot be null'); + } + + $this->container['imap_password'] = $imap_password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxByEmailAddressResult.php b/lib/Models/InboxByEmailAddressResult.php new file mode 100644 index 00000000..fc0ed3ac --- /dev/null +++ b/lib/Models/InboxByEmailAddressResult.php @@ -0,0 +1,459 @@ + + */ +class InboxByEmailAddressResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxByEmailAddressResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_id' => 'string', + 'exists' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_id' => 'uuid', + 'exists' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_id' => true, + 'exists' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_id' => 'inboxId', + 'exists' => 'exists' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_id' => 'setInboxId', + 'exists' => 'setExists' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_id' => 'getInboxId', + 'exists' => 'getExists' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('exists', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['exists'] === null) { + $invalidProperties[] = "'exists' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets exists + * + * @return bool + */ + public function getExists() + { + return $this->container['exists']; + } + + /** + * Sets exists + * + * @param bool $exists exists + * + * @return self + */ + public function setExists($exists) + { + + if (is_null($exists)) { + throw new \InvalidArgumentException('non-nullable exists cannot be null'); + } + + $this->container['exists'] = $exists; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxByNameResult.php b/lib/Models/InboxByNameResult.php new file mode 100644 index 00000000..f975756c --- /dev/null +++ b/lib/Models/InboxByNameResult.php @@ -0,0 +1,459 @@ + + */ +class InboxByNameResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxByNameResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_id' => 'string', + 'exists' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_id' => 'uuid', + 'exists' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_id' => true, + 'exists' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_id' => 'inboxId', + 'exists' => 'exists' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_id' => 'setInboxId', + 'exists' => 'setExists' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_id' => 'getInboxId', + 'exists' => 'getExists' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('exists', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['exists'] === null) { + $invalidProperties[] = "'exists' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets exists + * + * @return bool + */ + public function getExists() + { + return $this->container['exists']; + } + + /** + * Sets exists + * + * @param bool $exists exists + * + * @return self + */ + public function setExists($exists) + { + + if (is_null($exists)) { + throw new \InvalidArgumentException('non-nullable exists cannot be null'); + } + + $this->container['exists'] = $exists; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxDto.php b/lib/Models/InboxDto.php new file mode 100644 index 00000000..7ce1d995 --- /dev/null +++ b/lib/Models/InboxDto.php @@ -0,0 +1,946 @@ + + */ +class InboxDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'name' => 'string', + 'domain_id' => 'string', + 'description' => 'string', + 'email_address' => 'string', + 'expires_at' => 'string', + 'favourite' => 'bool', + 'tags' => 'string[]', + 'inbox_type' => 'string', + 'read_only' => 'bool', + 'virtual_inbox' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'name' => null, + 'domain_id' => 'uuid', + 'description' => null, + 'email_address' => null, + 'expires_at' => null, + 'favourite' => null, + 'tags' => null, + 'inbox_type' => null, + 'read_only' => null, + 'virtual_inbox' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => true, + 'created_at' => false, + 'name' => true, + 'domain_id' => true, + 'description' => true, + 'email_address' => false, + 'expires_at' => true, + 'favourite' => false, + 'tags' => true, + 'inbox_type' => true, + 'read_only' => false, + 'virtual_inbox' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'name' => 'name', + 'domain_id' => 'domainId', + 'description' => 'description', + 'email_address' => 'emailAddress', + 'expires_at' => 'expiresAt', + 'favourite' => 'favourite', + 'tags' => 'tags', + 'inbox_type' => 'inboxType', + 'read_only' => 'readOnly', + 'virtual_inbox' => 'virtualInbox' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'name' => 'setName', + 'domain_id' => 'setDomainId', + 'description' => 'setDescription', + 'email_address' => 'setEmailAddress', + 'expires_at' => 'setExpiresAt', + 'favourite' => 'setFavourite', + 'tags' => 'setTags', + 'inbox_type' => 'setInboxType', + 'read_only' => 'setReadOnly', + 'virtual_inbox' => 'setVirtualInbox' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'name' => 'getName', + 'domain_id' => 'getDomainId', + 'description' => 'getDescription', + 'email_address' => 'getEmailAddress', + 'expires_at' => 'getExpiresAt', + 'favourite' => 'getFavourite', + 'tags' => 'getTags', + 'inbox_type' => 'getInboxType', + 'read_only' => 'getReadOnly', + 'virtual_inbox' => 'getVirtualInbox' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInboxTypeAllowableValues() + { + return [ + self::INBOX_TYPE_HTTP_INBOX, + self::INBOX_TYPE_SMTP_INBOX, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('favourite', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('inbox_type', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('virtual_inbox', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['favourite'] === null) { + $invalidProperties[] = "'favourite' can't be null"; + } + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'inbox_type', must be one of '%s'", + $this->container['inbox_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['read_only'] === null) { + $invalidProperties[] = "'read_only' can't be null"; + } + if ($this->container['virtual_inbox'] === null) { + $invalidProperties[] = "'virtual_inbox' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id ID of user that inbox belongs to + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + array_push($this->openAPINullablesSetToNull, 'user_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('user_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id ID of custom domain used by the inbox if any + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of an inbox for labelling and searching purposes + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets expires_at + * + * @return string|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param string|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets favourite + * + * @return bool + */ + public function getFavourite() + { + return $this->container['favourite']; + } + + /** + * Sets favourite + * + * @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setFavourite($favourite) + { + + if (is_null($favourite)) { + throw new \InvalidArgumentException('non-nullable favourite cannot be null'); + } + + $this->container['favourite'] = $favourite; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets inbox_type + * + * @return string|null + */ + public function getInboxType() + { + return $this->container['inbox_type']; + } + + /** + * Sets inbox_type + * + * @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). + * + * @return self + */ + public function setInboxType($inbox_type) + { + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'inbox_type', must be one of '%s'", + $inbox_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($inbox_type)) { + array_push($this->openAPINullablesSetToNull, 'inbox_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_type'] = $inbox_type; + + return $this; + } + + /** + * Gets read_only + * + * @return bool + */ + public function getReadOnly() + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool $read_only Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes. + * + * @return self + */ + public function setReadOnly($read_only) + { + + if (is_null($read_only)) { + throw new \InvalidArgumentException('non-nullable read_only cannot be null'); + } + + $this->container['read_only'] = $read_only; + + return $this; + } + + /** + * Gets virtual_inbox + * + * @return bool + */ + public function getVirtualInbox() + { + return $this->container['virtual_inbox']; + } + + /** + * Sets virtual_inbox + * + * @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. + * + * @return self + */ + public function setVirtualInbox($virtual_inbox) + { + + if (is_null($virtual_inbox)) { + throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null'); + } + + $this->container['virtual_inbox'] = $virtual_inbox; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxExistsDto.php b/lib/Models/InboxExistsDto.php new file mode 100644 index 00000000..613f4930 --- /dev/null +++ b/lib/Models/InboxExistsDto.php @@ -0,0 +1,416 @@ + + */ +class InboxExistsDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxExistsDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exists' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exists' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exists' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'exists' => 'exists' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exists' => 'setExists' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exists' => 'getExists' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('exists', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['exists'] === null) { + $invalidProperties[] = "'exists' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets exists + * + * @return bool + */ + public function getExists() + { + return $this->container['exists']; + } + + /** + * Sets exists + * + * @param bool $exists exists + * + * @return self + */ + public function setExists($exists) + { + + if (is_null($exists)) { + throw new \InvalidArgumentException('non-nullable exists cannot be null'); + } + + $this->container['exists'] = $exists; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxForwarderDto.php b/lib/Models/InboxForwarderDto.php new file mode 100644 index 00000000..375871ba --- /dev/null +++ b/lib/Models/InboxForwarderDto.php @@ -0,0 +1,649 @@ + + */ +class InboxForwarderDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxForwarderDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'inbox_id' => 'string', + 'field' => 'string', + 'match' => 'string', + 'forward_to_recipients' => 'string[]', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'inbox_id' => 'uuid', + 'field' => null, + 'match' => null, + 'forward_to_recipients' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'inbox_id' => false, + 'field' => false, + 'match' => false, + 'forward_to_recipients' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'inbox_id' => 'inboxId', + 'field' => 'field', + 'match' => 'match', + 'forward_to_recipients' => 'forwardToRecipients', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'inbox_id' => 'setInboxId', + 'field' => 'setField', + 'match' => 'setMatch', + 'forward_to_recipients' => 'setForwardToRecipients', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'inbox_id' => 'getInboxId', + 'field' => 'getField', + 'match' => 'getMatch', + 'forward_to_recipients' => 'getForwardToRecipients', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const FIELD_RECIPIENTS = 'RECIPIENTS'; + public const FIELD_SENDER = 'SENDER'; + public const FIELD_SUBJECT = 'SUBJECT'; + public const FIELD_ATTACHMENTS = 'ATTACHMENTS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldAllowableValues() + { + return [ + self::FIELD_RECIPIENTS, + self::FIELD_SENDER, + self::FIELD_SUBJECT, + self::FIELD_ATTACHMENTS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('match', $data ?? [], null); + $this->setIfExists('forward_to_recipients', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['field'] === null) { + $invalidProperties[] = "'field' can't be null"; + } + $allowedValues = $this->getFieldAllowableValues(); + if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field', must be one of '%s'", + $this->container['field'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['match'] === null) { + $invalidProperties[] = "'match' can't be null"; + } + if ($this->container['forward_to_recipients'] === null) { + $invalidProperties[] = "'forward_to_recipients' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets field + * + * @return string + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string $field field + * + * @return self + */ + public function setField($field) + { + $allowedValues = $this->getFieldAllowableValues(); + if (!in_array($field, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field', must be one of '%s'", + $field, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets match + * + * @return string + */ + public function getMatch() + { + return $this->container['match']; + } + + /** + * Sets match + * + * @param string $match match + * + * @return self + */ + public function setMatch($match) + { + + if (is_null($match)) { + throw new \InvalidArgumentException('non-nullable match cannot be null'); + } + + $this->container['match'] = $match; + + return $this; + } + + /** + * Gets forward_to_recipients + * + * @return string[] + */ + public function getForwardToRecipients() + { + return $this->container['forward_to_recipients']; + } + + /** + * Sets forward_to_recipients + * + * @param string[] $forward_to_recipients forward_to_recipients + * + * @return self + */ + public function setForwardToRecipients($forward_to_recipients) + { + + if (is_null($forward_to_recipients)) { + throw new \InvalidArgumentException('non-nullable forward_to_recipients cannot be null'); + } + + $this->container['forward_to_recipients'] = $forward_to_recipients; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxForwarderEventProjection.php b/lib/Models/InboxForwarderEventProjection.php new file mode 100644 index 00000000..a6815646 --- /dev/null +++ b/lib/Models/InboxForwarderEventProjection.php @@ -0,0 +1,751 @@ + + */ +class InboxForwarderEventProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxForwarderEventProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'id' => 'string', + 'status' => 'string', + 'email_id' => 'string', + 'inbox_id' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'forwarder_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'id' => 'uuid', + 'status' => null, + 'email_id' => 'uuid', + 'inbox_id' => 'uuid', + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'forwarder_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true, + 'id' => true, + 'status' => true, + 'email_id' => true, + 'inbox_id' => true, + 'user_id' => true, + 'created_at' => false, + 'forwarder_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'id' => 'id', + 'status' => 'status', + 'email_id' => 'emailId', + 'inbox_id' => 'inboxId', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'forwarder_id' => 'forwarderId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'id' => 'setId', + 'status' => 'setStatus', + 'email_id' => 'setEmailId', + 'inbox_id' => 'setInboxId', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'forwarder_id' => 'setForwarderId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'id' => 'getId', + 'status' => 'getStatus', + 'email_id' => 'getEmailId', + 'inbox_id' => 'getInboxId', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'forwarder_id' => 'getForwarderId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCESS = 'SUCCESS'; + public const STATUS_FAILURE = 'FAILURE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCESS, + self::STATUS_FAILURE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('email_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('forwarder_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets email_id + * + * @return string|null + */ + public function getEmailId() + { + return $this->container['email_id']; + } + + /** + * Sets email_id + * + * @param string|null $email_id email_id + * + * @return self + */ + public function setEmailId($email_id) + { + + if (is_null($email_id)) { + array_push($this->openAPINullablesSetToNull, 'email_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_id'] = $email_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + array_push($this->openAPINullablesSetToNull, 'user_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('user_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets forwarder_id + * + * @return string|null + */ + public function getForwarderId() + { + return $this->container['forwarder_id']; + } + + /** + * Sets forwarder_id + * + * @param string|null $forwarder_id forwarder_id + * + * @return self + */ + public function setForwarderId($forwarder_id) + { + + if (is_null($forwarder_id)) { + array_push($this->openAPINullablesSetToNull, 'forwarder_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('forwarder_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['forwarder_id'] = $forwarder_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxForwarderTestOptions.php b/lib/Models/InboxForwarderTestOptions.php new file mode 100644 index 00000000..1a729572 --- /dev/null +++ b/lib/Models/InboxForwarderTestOptions.php @@ -0,0 +1,416 @@ + + */ +class InboxForwarderTestOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxForwarderTestOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'test_value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'test_value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'test_value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'test_value' => 'testValue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'test_value' => 'setTestValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'test_value' => 'getTestValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('test_value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['test_value'] === null) { + $invalidProperties[] = "'test_value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets test_value + * + * @return string + */ + public function getTestValue() + { + return $this->container['test_value']; + } + + /** + * Sets test_value + * + * @param string $test_value test_value + * + * @return self + */ + public function setTestValue($test_value) + { + + if (is_null($test_value)) { + throw new \InvalidArgumentException('non-nullable test_value cannot be null'); + } + + $this->container['test_value'] = $test_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxForwarderTestResult.php b/lib/Models/InboxForwarderTestResult.php new file mode 100644 index 00000000..204ef048 --- /dev/null +++ b/lib/Models/InboxForwarderTestResult.php @@ -0,0 +1,455 @@ + + */ +class InboxForwarderTestResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxForwarderTestResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'matches' => 'array', + 'does_match' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'matches' => null, + 'does_match' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'matches' => false, + 'does_match' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'matches' => 'matches', + 'does_match' => 'doesMatch' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'matches' => 'setMatches', + 'does_match' => 'setDoesMatch' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'matches' => 'getMatches', + 'does_match' => 'getDoesMatch' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('matches', $data ?? [], null); + $this->setIfExists('does_match', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['matches'] === null) { + $invalidProperties[] = "'matches' can't be null"; + } + if ($this->container['does_match'] === null) { + $invalidProperties[] = "'does_match' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets matches + * + * @return array + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param array $matches matches + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + throw new \InvalidArgumentException('non-nullable matches cannot be null'); + } + + $this->container['matches'] = $matches; + + return $this; + } + + /** + * Gets does_match + * + * @return bool + */ + public function getDoesMatch() + { + return $this->container['does_match']; + } + + /** + * Sets does_match + * + * @param bool $does_match does_match + * + * @return self + */ + public function setDoesMatch($does_match) + { + + if (is_null($does_match)) { + throw new \InvalidArgumentException('non-nullable does_match cannot be null'); + } + + $this->container['does_match'] = $does_match; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxIdItem.php b/lib/Models/InboxIdItem.php new file mode 100644 index 00000000..f60ebef1 --- /dev/null +++ b/lib/Models/InboxIdItem.php @@ -0,0 +1,455 @@ + + */ +class InboxIdItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxIdItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'email_address' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'email_address' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email_address' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'email_address' => 'emailAddress' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'email_address' => 'setEmailAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'email_address' => 'getEmailAddress' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxIdsResult.php b/lib/Models/InboxIdsResult.php new file mode 100644 index 00000000..5f3b50a4 --- /dev/null +++ b/lib/Models/InboxIdsResult.php @@ -0,0 +1,416 @@ + + */ +class InboxIdsResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxIdsResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_ids' => '\MailSlurp\Models\InboxIdItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_ids' => 'inboxIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_ids' => 'setInboxIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_ids' => 'getInboxIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_ids'] === null) { + $invalidProperties[] = "'inbox_ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_ids + * + * @return \MailSlurp\Models\InboxIdItem[] + */ + public function getInboxIds() + { + return $this->container['inbox_ids']; + } + + /** + * Sets inbox_ids + * + * @param \MailSlurp\Models\InboxIdItem[] $inbox_ids inbox_ids + * + * @return self + */ + public function setInboxIds($inbox_ids) + { + + if (is_null($inbox_ids)) { + throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null'); + } + + $this->container['inbox_ids'] = $inbox_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxPreview.php b/lib/Models/InboxPreview.php new file mode 100644 index 00000000..1eb00778 --- /dev/null +++ b/lib/Models/InboxPreview.php @@ -0,0 +1,864 @@ + + */ +class InboxPreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxPreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'domain_id' => 'string', + 'email_address' => 'string', + 'created_at' => '\DateTime', + 'favourite' => 'bool', + 'name' => 'string', + 'tags' => 'string[]', + 'team_access' => 'bool', + 'inbox_type' => 'string', + 'virtual_inbox' => 'bool', + 'expires_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'domain_id' => 'uuid', + 'email_address' => null, + 'created_at' => 'date-time', + 'favourite' => null, + 'name' => null, + 'tags' => null, + 'team_access' => null, + 'inbox_type' => null, + 'virtual_inbox' => null, + 'expires_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domain_id' => true, + 'email_address' => true, + 'created_at' => false, + 'favourite' => false, + 'name' => true, + 'tags' => true, + 'team_access' => false, + 'inbox_type' => true, + 'virtual_inbox' => false, + 'expires_at' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'domain_id' => 'domainId', + 'email_address' => 'emailAddress', + 'created_at' => 'createdAt', + 'favourite' => 'favourite', + 'name' => 'name', + 'tags' => 'tags', + 'team_access' => 'teamAccess', + 'inbox_type' => 'inboxType', + 'virtual_inbox' => 'virtualInbox', + 'expires_at' => 'expiresAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'domain_id' => 'setDomainId', + 'email_address' => 'setEmailAddress', + 'created_at' => 'setCreatedAt', + 'favourite' => 'setFavourite', + 'name' => 'setName', + 'tags' => 'setTags', + 'team_access' => 'setTeamAccess', + 'inbox_type' => 'setInboxType', + 'virtual_inbox' => 'setVirtualInbox', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'domain_id' => 'getDomainId', + 'email_address' => 'getEmailAddress', + 'created_at' => 'getCreatedAt', + 'favourite' => 'getFavourite', + 'name' => 'getName', + 'tags' => 'getTags', + 'team_access' => 'getTeamAccess', + 'inbox_type' => 'getInboxType', + 'virtual_inbox' => 'getVirtualInbox', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInboxTypeAllowableValues() + { + return [ + self::INBOX_TYPE_HTTP_INBOX, + self::INBOX_TYPE_SMTP_INBOX, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('favourite', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('team_access', $data ?? [], null); + $this->setIfExists('inbox_type', $data ?? [], null); + $this->setIfExists('virtual_inbox', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['favourite'] === null) { + $invalidProperties[] = "'favourite' can't be null"; + } + if ($this->container['team_access'] === null) { + $invalidProperties[] = "'team_access' can't be null"; + } + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'inbox_type', must be one of '%s'", + $this->container['inbox_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['virtual_inbox'] === null) { + $invalidProperties[] = "'virtual_inbox' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id ID of custom domain used by the inbox if any + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets email_address + * + * @return string|null + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string|null $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + array_push($this->openAPINullablesSetToNull, 'email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets favourite + * + * @return bool + */ + public function getFavourite() + { + return $this->container['favourite']; + } + + /** + * Sets favourite + * + * @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setFavourite($favourite) + { + + if (is_null($favourite)) { + throw new \InvalidArgumentException('non-nullable favourite cannot be null'); + } + + $this->container['favourite'] = $favourite; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets team_access + * + * @return bool + */ + public function getTeamAccess() + { + return $this->container['team_access']; + } + + /** + * Sets team_access + * + * @param bool $team_access Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/ + * + * @return self + */ + public function setTeamAccess($team_access) + { + + if (is_null($team_access)) { + throw new \InvalidArgumentException('non-nullable team_access cannot be null'); + } + + $this->container['team_access'] = $team_access; + + return $this; + } + + /** + * Gets inbox_type + * + * @return string|null + */ + public function getInboxType() + { + return $this->container['inbox_type']; + } + + /** + * Sets inbox_type + * + * @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). + * + * @return self + */ + public function setInboxType($inbox_type) + { + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'inbox_type', must be one of '%s'", + $inbox_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($inbox_type)) { + array_push($this->openAPINullablesSetToNull, 'inbox_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_type'] = $inbox_type; + + return $this; + } + + /** + * Gets virtual_inbox + * + * @return bool + */ + public function getVirtualInbox() + { + return $this->container['virtual_inbox']; + } + + /** + * Sets virtual_inbox + * + * @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. + * + * @return self + */ + public function setVirtualInbox($virtual_inbox) + { + + if (is_null($virtual_inbox)) { + throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null'); + } + + $this->container['virtual_inbox'] = $virtual_inbox; + + return $this; + } + + /** + * Gets expires_at + * + * @return string|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param string|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxRulesetDto.php b/lib/Models/InboxRulesetDto.php new file mode 100644 index 00000000..56d0dfe9 --- /dev/null +++ b/lib/Models/InboxRulesetDto.php @@ -0,0 +1,752 @@ + + */ +class InboxRulesetDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxRulesetDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'inbox_id' => 'string', + 'scope' => 'string', + 'action' => 'string', + 'target' => 'string', + 'handler' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'inbox_id' => 'uuid', + 'scope' => null, + 'action' => null, + 'target' => null, + 'handler' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'inbox_id' => false, + 'scope' => false, + 'action' => false, + 'target' => false, + 'handler' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'inbox_id' => 'inboxId', + 'scope' => 'scope', + 'action' => 'action', + 'target' => 'target', + 'handler' => 'handler', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'inbox_id' => 'setInboxId', + 'scope' => 'setScope', + 'action' => 'setAction', + 'target' => 'setTarget', + 'handler' => 'setHandler', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'inbox_id' => 'getInboxId', + 'scope' => 'getScope', + 'action' => 'getAction', + 'target' => 'getTarget', + 'handler' => 'getHandler', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SCOPE_RECEIVING_EMAILS = 'RECEIVING_EMAILS'; + public const SCOPE_SENDING_EMAILS = 'SENDING_EMAILS'; + public const ACTION_BLOCK = 'BLOCK'; + public const ACTION_ALLOW = 'ALLOW'; + public const ACTION_FILTER_REMOVE = 'FILTER_REMOVE'; + public const HANDLER_EXCEPTION = 'EXCEPTION'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getScopeAllowableValues() + { + return [ + self::SCOPE_RECEIVING_EMAILS, + self::SCOPE_SENDING_EMAILS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getActionAllowableValues() + { + return [ + self::ACTION_BLOCK, + self::ACTION_ALLOW, + self::ACTION_FILTER_REMOVE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHandlerAllowableValues() + { + return [ + self::HANDLER_EXCEPTION, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('target', $data ?? [], null); + $this->setIfExists('handler', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['scope'] === null) { + $invalidProperties[] = "'scope' can't be null"; + } + $allowedValues = $this->getScopeAllowableValues(); + if (!is_null($this->container['scope']) && !in_array($this->container['scope'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'scope', must be one of '%s'", + $this->container['scope'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['action'] === null) { + $invalidProperties[] = "'action' can't be null"; + } + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'action', must be one of '%s'", + $this->container['action'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['target'] === null) { + $invalidProperties[] = "'target' can't be null"; + } + if ($this->container['handler'] === null) { + $invalidProperties[] = "'handler' can't be null"; + } + $allowedValues = $this->getHandlerAllowableValues(); + if (!is_null($this->container['handler']) && !in_array($this->container['handler'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'handler', must be one of '%s'", + $this->container['handler'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets scope + * + * @return string + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string $scope scope + * + * @return self + */ + public function setScope($scope) + { + $allowedValues = $this->getScopeAllowableValues(); + if (!in_array($scope, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'scope', must be one of '%s'", + $scope, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($scope)) { + throw new \InvalidArgumentException('non-nullable scope cannot be null'); + } + + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets action + * + * @return string + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string $action action + * + * @return self + */ + public function setAction($action) + { + $allowedValues = $this->getActionAllowableValues(); + if (!in_array($action, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'action', must be one of '%s'", + $action, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets target + * + * @return string + */ + public function getTarget() + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param string $target target + * + * @return self + */ + public function setTarget($target) + { + + if (is_null($target)) { + throw new \InvalidArgumentException('non-nullable target cannot be null'); + } + + $this->container['target'] = $target; + + return $this; + } + + /** + * Gets handler + * + * @return string + */ + public function getHandler() + { + return $this->container['handler']; + } + + /** + * Sets handler + * + * @param string $handler handler + * + * @return self + */ + public function setHandler($handler) + { + $allowedValues = $this->getHandlerAllowableValues(); + if (!in_array($handler, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'handler', must be one of '%s'", + $handler, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($handler)) { + throw new \InvalidArgumentException('non-nullable handler cannot be null'); + } + + $this->container['handler'] = $handler; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxRulesetTestOptions.php b/lib/Models/InboxRulesetTestOptions.php new file mode 100644 index 00000000..44a34ddd --- /dev/null +++ b/lib/Models/InboxRulesetTestOptions.php @@ -0,0 +1,416 @@ + + */ +class InboxRulesetTestOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxRulesetTestOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'test_target' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'test_target' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'test_target' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'test_target' => 'testTarget' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'test_target' => 'setTestTarget' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'test_target' => 'getTestTarget' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('test_target', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['test_target'] === null) { + $invalidProperties[] = "'test_target' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets test_target + * + * @return string + */ + public function getTestTarget() + { + return $this->container['test_target']; + } + + /** + * Sets test_target + * + * @param string $test_target test_target + * + * @return self + */ + public function setTestTarget($test_target) + { + + if (is_null($test_target)) { + throw new \InvalidArgumentException('non-nullable test_target cannot be null'); + } + + $this->container['test_target'] = $test_target; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/InboxRulesetTestResult.php b/lib/Models/InboxRulesetTestResult.php new file mode 100644 index 00000000..4248441f --- /dev/null +++ b/lib/Models/InboxRulesetTestResult.php @@ -0,0 +1,455 @@ + + */ +class InboxRulesetTestResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InboxRulesetTestResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ruleset_matches' => 'array', + 'matches' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ruleset_matches' => null, + 'matches' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ruleset_matches' => false, + 'matches' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ruleset_matches' => 'rulesetMatches', + 'matches' => 'matches' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ruleset_matches' => 'setRulesetMatches', + 'matches' => 'setMatches' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ruleset_matches' => 'getRulesetMatches', + 'matches' => 'getMatches' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ruleset_matches', $data ?? [], null); + $this->setIfExists('matches', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ruleset_matches'] === null) { + $invalidProperties[] = "'ruleset_matches' can't be null"; + } + if ($this->container['matches'] === null) { + $invalidProperties[] = "'matches' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ruleset_matches + * + * @return array + */ + public function getRulesetMatches() + { + return $this->container['ruleset_matches']; + } + + /** + * Sets ruleset_matches + * + * @param array $ruleset_matches Map of inbox ruleset ID to boolean of if target matches + * + * @return self + */ + public function setRulesetMatches($ruleset_matches) + { + + if (is_null($ruleset_matches)) { + throw new \InvalidArgumentException('non-nullable ruleset_matches cannot be null'); + } + + $this->container['ruleset_matches'] = $ruleset_matches; + + return $this; + } + + /** + * Gets matches + * + * @return bool + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param bool $matches matches + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + throw new \InvalidArgumentException('non-nullable matches cannot be null'); + } + + $this->container['matches'] = $matches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/JSONSchemaDto.php b/lib/Models/JSONSchemaDto.php new file mode 100644 index 00000000..67edcf49 --- /dev/null +++ b/lib/Models/JSONSchemaDto.php @@ -0,0 +1,416 @@ + + */ +class JSONSchemaDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JSONSchemaDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ListUnsubscribeRecipientProjection.php b/lib/Models/ListUnsubscribeRecipientProjection.php new file mode 100644 index 00000000..4fd05f6e --- /dev/null +++ b/lib/Models/ListUnsubscribeRecipientProjection.php @@ -0,0 +1,537 @@ + + */ +class ListUnsubscribeRecipientProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ListUnsubscribeRecipientProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'email_address' => 'string', + 'created_at' => '\DateTime', + 'domain_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'email_address' => null, + 'created_at' => 'date-time', + 'domain_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email_address' => false, + 'created_at' => false, + 'domain_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'email_address' => 'emailAddress', + 'created_at' => 'createdAt', + 'domain_id' => 'domainId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'email_address' => 'setEmailAddress', + 'created_at' => 'setCreatedAt', + 'domain_id' => 'setDomainId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'email_address' => 'getEmailAddress', + 'created_at' => 'getCreatedAt', + 'domain_id' => 'getDomainId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id domain_id + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/MatchOption.php b/lib/Models/MatchOption.php new file mode 100644 index 00000000..55431936 --- /dev/null +++ b/lib/Models/MatchOption.php @@ -0,0 +1,568 @@ + + */ +class MatchOption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MatchOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'field' => 'string', + 'should' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field' => null, + 'should' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'field' => false, + 'should' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'field' => 'field', + 'should' => 'should', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field' => 'setField', + 'should' => 'setShould', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field' => 'getField', + 'should' => 'getShould', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const FIELD_SUBJECT = 'SUBJECT'; + public const FIELD_TO = 'TO'; + public const FIELD_BCC = 'BCC'; + public const FIELD_CC = 'CC'; + public const FIELD_FROM = 'FROM'; + public const SHOULD_CONTAIN = 'CONTAIN'; + public const SHOULD_EQUAL = 'EQUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldAllowableValues() + { + return [ + self::FIELD_SUBJECT, + self::FIELD_TO, + self::FIELD_BCC, + self::FIELD_CC, + self::FIELD_FROM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getShouldAllowableValues() + { + return [ + self::SHOULD_CONTAIN, + self::SHOULD_EQUAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('should', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['field'] === null) { + $invalidProperties[] = "'field' can't be null"; + } + $allowedValues = $this->getFieldAllowableValues(); + if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field', must be one of '%s'", + $this->container['field'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['should'] === null) { + $invalidProperties[] = "'should' can't be null"; + } + $allowedValues = $this->getShouldAllowableValues(); + if (!is_null($this->container['should']) && !in_array($this->container['should'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'should', must be one of '%s'", + $this->container['should'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets field + * + * @return string + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string $field Fields of an email object that can be used to filter results + * + * @return self + */ + public function setField($field) + { + $allowedValues = $this->getFieldAllowableValues(); + if (!in_array($field, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field', must be one of '%s'", + $field, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets should + * + * @return string + */ + public function getShould() + { + return $this->container['should']; + } + + /** + * Sets should + * + * @param string $should How the value of the email field specified should be compared to the value given in the match options. + * + * @return self + */ + public function setShould($should) + { + $allowedValues = $this->getShouldAllowableValues(); + if (!in_array($should, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'should', must be one of '%s'", + $should, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($should)) { + throw new \InvalidArgumentException('non-nullable should cannot be null'); + } + + $this->container['should'] = $should; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed. + * + * @return self + */ + public function setValue($value) + { + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/MatchOptions.php b/lib/Models/MatchOptions.php new file mode 100644 index 00000000..678d2e17 --- /dev/null +++ b/lib/Models/MatchOptions.php @@ -0,0 +1,463 @@ + + */ +class MatchOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MatchOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'matches' => '\MailSlurp\Models\MatchOption[]', + 'conditions' => '\MailSlurp\Models\ConditionOption[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'matches' => null, + 'conditions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'matches' => true, + 'conditions' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'matches' => 'matches', + 'conditions' => 'conditions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'matches' => 'setMatches', + 'conditions' => 'setConditions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'matches' => 'getMatches', + 'conditions' => 'getConditions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('matches', $data ?? [], null); + $this->setIfExists('conditions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets matches + * + * @return \MailSlurp\Models\MatchOption[]|null + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param \MailSlurp\Models\MatchOption[]|null $matches Zero or more match options such as `{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }`. Options are additive so if one does not match the email is excluded from results + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + array_push($this->openAPINullablesSetToNull, 'matches'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('matches', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['matches'] = $matches; + + return $this; + } + + /** + * Gets conditions + * + * @return \MailSlurp\Models\ConditionOption[]|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \MailSlurp\Models\ConditionOption[]|null $conditions Zero or more conditions such as `{ condition: 'HAS_ATTACHMENTS', value: 'TRUE' }`. Note the values are the strings `TRUE|FALSE` not booleans. + * + * @return self + */ + public function setConditions($conditions) + { + + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['conditions'] = $conditions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/MissedEmailDto.php b/lib/Models/MissedEmailDto.php new file mode 100644 index 00000000..6dd007dc --- /dev/null +++ b/lib/Models/MissedEmailDto.php @@ -0,0 +1,1033 @@ + + */ +class MissedEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MissedEmailDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'subject' => 'string', + 'body_excerpt' => 'string', + 'attachment_count' => 'int', + 'from' => 'string', + 'raw_url' => 'string', + 'raw_key' => 'string', + 'raw_bucket' => 'string', + 'can_restore' => 'bool', + 'to' => 'string[]', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'inbox_ids' => 'string[]', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'subject' => null, + 'body_excerpt' => null, + 'attachment_count' => 'int32', + 'from' => null, + 'raw_url' => null, + 'raw_key' => null, + 'raw_bucket' => null, + 'can_restore' => null, + 'to' => null, + 'cc' => null, + 'bcc' => null, + 'inbox_ids' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => true, + 'subject' => true, + 'body_excerpt' => true, + 'attachment_count' => false, + 'from' => true, + 'raw_url' => true, + 'raw_key' => true, + 'raw_bucket' => true, + 'can_restore' => true, + 'to' => false, + 'cc' => false, + 'bcc' => false, + 'inbox_ids' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'subject' => 'subject', + 'body_excerpt' => 'bodyExcerpt', + 'attachment_count' => 'attachmentCount', + 'from' => 'from', + 'raw_url' => 'rawUrl', + 'raw_key' => 'rawKey', + 'raw_bucket' => 'rawBucket', + 'can_restore' => 'canRestore', + 'to' => 'to', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'inbox_ids' => 'inboxIds', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'subject' => 'setSubject', + 'body_excerpt' => 'setBodyExcerpt', + 'attachment_count' => 'setAttachmentCount', + 'from' => 'setFrom', + 'raw_url' => 'setRawUrl', + 'raw_key' => 'setRawKey', + 'raw_bucket' => 'setRawBucket', + 'can_restore' => 'setCanRestore', + 'to' => 'setTo', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'inbox_ids' => 'setInboxIds', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'subject' => 'getSubject', + 'body_excerpt' => 'getBodyExcerpt', + 'attachment_count' => 'getAttachmentCount', + 'from' => 'getFrom', + 'raw_url' => 'getRawUrl', + 'raw_key' => 'getRawKey', + 'raw_bucket' => 'getRawBucket', + 'can_restore' => 'getCanRestore', + 'to' => 'getTo', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'inbox_ids' => 'getInboxIds', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('body_excerpt', $data ?? [], null); + $this->setIfExists('attachment_count', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('raw_url', $data ?? [], null); + $this->setIfExists('raw_key', $data ?? [], null); + $this->setIfExists('raw_bucket', $data ?? [], null); + $this->setIfExists('can_restore', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('inbox_ids', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['attachment_count'] === null) { + $invalidProperties[] = "'attachment_count' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['cc'] === null) { + $invalidProperties[] = "'cc' can't be null"; + } + if ($this->container['bcc'] === null) { + $invalidProperties[] = "'bcc' can't be null"; + } + if ($this->container['inbox_ids'] === null) { + $invalidProperties[] = "'inbox_ids' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + array_push($this->openAPINullablesSetToNull, 'user_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('user_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets body_excerpt + * + * @return string|null + */ + public function getBodyExcerpt() + { + return $this->container['body_excerpt']; + } + + /** + * Sets body_excerpt + * + * @param string|null $body_excerpt body_excerpt + * + * @return self + */ + public function setBodyExcerpt($body_excerpt) + { + + if (is_null($body_excerpt)) { + array_push($this->openAPINullablesSetToNull, 'body_excerpt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_excerpt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_excerpt'] = $body_excerpt; + + return $this; + } + + /** + * Gets attachment_count + * + * @return int + */ + public function getAttachmentCount() + { + return $this->container['attachment_count']; + } + + /** + * Sets attachment_count + * + * @param int $attachment_count attachment_count + * + * @return self + */ + public function setAttachmentCount($attachment_count) + { + + if (is_null($attachment_count)) { + throw new \InvalidArgumentException('non-nullable attachment_count cannot be null'); + } + + $this->container['attachment_count'] = $attachment_count; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from from + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets raw_url + * + * @return string|null + */ + public function getRawUrl() + { + return $this->container['raw_url']; + } + + /** + * Sets raw_url + * + * @param string|null $raw_url raw_url + * + * @return self + */ + public function setRawUrl($raw_url) + { + + if (is_null($raw_url)) { + array_push($this->openAPINullablesSetToNull, 'raw_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('raw_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['raw_url'] = $raw_url; + + return $this; + } + + /** + * Gets raw_key + * + * @return string|null + */ + public function getRawKey() + { + return $this->container['raw_key']; + } + + /** + * Sets raw_key + * + * @param string|null $raw_key raw_key + * + * @return self + */ + public function setRawKey($raw_key) + { + + if (is_null($raw_key)) { + array_push($this->openAPINullablesSetToNull, 'raw_key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('raw_key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['raw_key'] = $raw_key; + + return $this; + } + + /** + * Gets raw_bucket + * + * @return string|null + */ + public function getRawBucket() + { + return $this->container['raw_bucket']; + } + + /** + * Sets raw_bucket + * + * @param string|null $raw_bucket raw_bucket + * + * @return self + */ + public function setRawBucket($raw_bucket) + { + + if (is_null($raw_bucket)) { + array_push($this->openAPINullablesSetToNull, 'raw_bucket'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('raw_bucket', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['raw_bucket'] = $raw_bucket; + + return $this; + } + + /** + * Gets can_restore + * + * @return bool|null + */ + public function getCanRestore() + { + return $this->container['can_restore']; + } + + /** + * Sets can_restore + * + * @param bool|null $can_restore can_restore + * + * @return self + */ + public function setCanRestore($can_restore) + { + + if (is_null($can_restore)) { + array_push($this->openAPINullablesSetToNull, 'can_restore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('can_restore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['can_restore'] = $can_restore; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets cc + * + * @return string[] + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[] $cc cc + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[] + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[] $bcc bcc + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets inbox_ids + * + * @return string[] + */ + public function getInboxIds() + { + return $this->container['inbox_ids']; + } + + /** + * Sets inbox_ids + * + * @param string[] $inbox_ids inbox_ids + * + * @return self + */ + public function setInboxIds($inbox_ids) + { + + if (is_null($inbox_ids)) { + throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null'); + } + + $this->container['inbox_ids'] = $inbox_ids; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/MissedEmailProjection.php b/lib/Models/MissedEmailProjection.php new file mode 100644 index 00000000..3ff2bf1e --- /dev/null +++ b/lib/Models/MissedEmailProjection.php @@ -0,0 +1,584 @@ + + */ +class MissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MissedEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'from' => 'string', + 'subject' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'from' => null, + 'subject' => null, + 'user_id' => 'uuid', + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from' => true, + 'subject' => true, + 'user_id' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'from' => 'from', + 'subject' => 'subject', + 'user_id' => 'userId', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'from' => 'setFrom', + 'subject' => 'setSubject', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'from' => 'getFrom', + 'subject' => 'getSubject', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from from + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + array_push($this->openAPINullablesSetToNull, 'user_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('user_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ModelInterface.php b/lib/Models/ModelInterface.php new file mode 100644 index 00000000..a795e333 --- /dev/null +++ b/lib/Models/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class NameServerRecord implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NameServerRecord'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'raw' => 'string', + 'record_type' => 'string', + 'priority' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'raw' => null, + 'record_type' => null, + 'priority' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'raw' => false, + 'record_type' => false, + 'priority' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'raw' => 'raw', + 'record_type' => 'recordType', + 'priority' => 'priority', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'raw' => 'setRaw', + 'record_type' => 'setRecordType', + 'priority' => 'setPriority', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'raw' => 'getRaw', + 'record_type' => 'getRecordType', + 'priority' => 'getPriority', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('raw', $data ?? [], null); + $this->setIfExists('record_type', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['raw'] === null) { + $invalidProperties[] = "'raw' can't be null"; + } + if ($this->container['record_type'] === null) { + $invalidProperties[] = "'record_type' can't be null"; + } + if ($this->container['priority'] === null) { + $invalidProperties[] = "'priority' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets raw + * + * @return string + */ + public function getRaw() + { + return $this->container['raw']; + } + + /** + * Sets raw + * + * @param string $raw raw + * + * @return self + */ + public function setRaw($raw) + { + + if (is_null($raw)) { + throw new \InvalidArgumentException('non-nullable raw cannot be null'); + } + + $this->container['raw'] = $raw; + + return $this; + } + + /** + * Gets record_type + * + * @return string + */ + public function getRecordType() + { + return $this->container['record_type']; + } + + /** + * Sets record_type + * + * @param string $record_type record_type + * + * @return self + */ + public function setRecordType($record_type) + { + + if (is_null($record_type)) { + throw new \InvalidArgumentException('non-nullable record_type cannot be null'); + } + + $this->container['record_type'] = $record_type; + + return $this; + } + + /** + * Gets priority + * + * @return string + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param string $priority priority + * + * @return self + */ + public function setPriority($priority) + { + + if (is_null($priority)) { + throw new \InvalidArgumentException('non-nullable priority cannot be null'); + } + + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/OrganizationInboxProjection.php b/lib/Models/OrganizationInboxProjection.php new file mode 100644 index 00000000..8716a708 --- /dev/null +++ b/lib/Models/OrganizationInboxProjection.php @@ -0,0 +1,860 @@ + + */ +class OrganizationInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrganizationInboxProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'domain_id' => 'string', + 'created_at' => '\DateTime', + 'name' => 'string', + 'email_address' => 'string', + 'favourite' => 'bool', + 'tags' => 'string[]', + 'team_access' => 'bool', + 'inbox_type' => 'string', + 'read_only' => 'bool', + 'virtual_inbox' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'domain_id' => 'uuid', + 'created_at' => 'date-time', + 'name' => null, + 'email_address' => null, + 'favourite' => null, + 'tags' => null, + 'team_access' => null, + 'inbox_type' => null, + 'read_only' => null, + 'virtual_inbox' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domain_id' => true, + 'created_at' => false, + 'name' => true, + 'email_address' => true, + 'favourite' => false, + 'tags' => true, + 'team_access' => false, + 'inbox_type' => true, + 'read_only' => false, + 'virtual_inbox' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'domain_id' => 'domainId', + 'created_at' => 'createdAt', + 'name' => 'name', + 'email_address' => 'emailAddress', + 'favourite' => 'favourite', + 'tags' => 'tags', + 'team_access' => 'teamAccess', + 'inbox_type' => 'inboxType', + 'read_only' => 'readOnly', + 'virtual_inbox' => 'virtualInbox' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'domain_id' => 'setDomainId', + 'created_at' => 'setCreatedAt', + 'name' => 'setName', + 'email_address' => 'setEmailAddress', + 'favourite' => 'setFavourite', + 'tags' => 'setTags', + 'team_access' => 'setTeamAccess', + 'inbox_type' => 'setInboxType', + 'read_only' => 'setReadOnly', + 'virtual_inbox' => 'setVirtualInbox' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'domain_id' => 'getDomainId', + 'created_at' => 'getCreatedAt', + 'name' => 'getName', + 'email_address' => 'getEmailAddress', + 'favourite' => 'getFavourite', + 'tags' => 'getTags', + 'team_access' => 'getTeamAccess', + 'inbox_type' => 'getInboxType', + 'read_only' => 'getReadOnly', + 'virtual_inbox' => 'getVirtualInbox' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX'; + public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInboxTypeAllowableValues() + { + return [ + self::INBOX_TYPE_HTTP_INBOX, + self::INBOX_TYPE_SMTP_INBOX, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('favourite', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('team_access', $data ?? [], null); + $this->setIfExists('inbox_type', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('virtual_inbox', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['favourite'] === null) { + $invalidProperties[] = "'favourite' can't be null"; + } + if ($this->container['team_access'] === null) { + $invalidProperties[] = "'team_access' can't be null"; + } + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'inbox_type', must be one of '%s'", + $this->container['inbox_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['read_only'] === null) { + $invalidProperties[] = "'read_only' can't be null"; + } + if ($this->container['virtual_inbox'] === null) { + $invalidProperties[] = "'virtual_inbox' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically. + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id ID of custom domain used by the inbox if any + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`. + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email_address + * + * @return string|null + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string|null $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + array_push($this->openAPINullablesSetToNull, 'email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets favourite + * + * @return bool + */ + public function getFavourite() + { + return $this->container['favourite']; + } + + /** + * Sets favourite + * + * @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setFavourite($favourite) + { + + if (is_null($favourite)) { + throw new \InvalidArgumentException('non-nullable favourite cannot be null'); + } + + $this->container['favourite'] = $favourite; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets team_access + * + * @return bool + */ + public function getTeamAccess() + { + return $this->container['team_access']; + } + + /** + * Sets team_access + * + * @param bool $team_access Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/ + * + * @return self + */ + public function setTeamAccess($team_access) + { + + if (is_null($team_access)) { + throw new \InvalidArgumentException('non-nullable team_access cannot be null'); + } + + $this->container['team_access'] = $team_access; + + return $this; + } + + /** + * Gets inbox_type + * + * @return string|null + */ + public function getInboxType() + { + return $this->container['inbox_type']; + } + + /** + * Sets inbox_type + * + * @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send). + * + * @return self + */ + public function setInboxType($inbox_type) + { + $allowedValues = $this->getInboxTypeAllowableValues(); + if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'inbox_type', must be one of '%s'", + $inbox_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($inbox_type)) { + array_push($this->openAPINullablesSetToNull, 'inbox_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_type'] = $inbox_type; + + return $this; + } + + /** + * Gets read_only + * + * @return bool + */ + public function getReadOnly() + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool $read_only Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes. + * + * @return self + */ + public function setReadOnly($read_only) + { + + if (is_null($read_only)) { + throw new \InvalidArgumentException('non-nullable read_only cannot be null'); + } + + $this->container['read_only'] = $read_only; + + return $this; + } + + /** + * Gets virtual_inbox + * + * @return bool + */ + public function getVirtualInbox() + { + return $this->container['virtual_inbox']; + } + + /** + * Sets virtual_inbox + * + * @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions. + * + * @return self + */ + public function setVirtualInbox($virtual_inbox) + { + + if (is_null($virtual_inbox)) { + throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null'); + } + + $this->container['virtual_inbox'] = $virtual_inbox; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageAlias.php b/lib/Models/PageAlias.php new file mode 100644 index 00000000..6227b332 --- /dev/null +++ b/lib/Models/PageAlias.php @@ -0,0 +1,809 @@ + + */ +class PageAlias implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageAlias'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\AliasProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\AliasProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\AliasProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageAttachmentEntity.php b/lib/Models/PageAttachmentEntity.php new file mode 100644 index 00000000..82ec2dff --- /dev/null +++ b/lib/Models/PageAttachmentEntity.php @@ -0,0 +1,809 @@ + + */ +class PageAttachmentEntity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageAttachmentEntity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\AttachmentProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\AttachmentProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\AttachmentProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageBouncedEmail.php b/lib/Models/PageBouncedEmail.php new file mode 100644 index 00000000..4a8f8f5f --- /dev/null +++ b/lib/Models/PageBouncedEmail.php @@ -0,0 +1,809 @@ + + */ +class PageBouncedEmail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageBouncedEmail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\BounceProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\BounceProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\BounceProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageBouncedRecipients.php b/lib/Models/PageBouncedRecipients.php new file mode 100644 index 00000000..211093f8 --- /dev/null +++ b/lib/Models/PageBouncedRecipients.php @@ -0,0 +1,809 @@ + + */ +class PageBouncedRecipients implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageBouncedRecipients'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\BounceRecipientProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\BounceRecipientProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\BounceRecipientProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageComplaint.php b/lib/Models/PageComplaint.php new file mode 100644 index 00000000..8ba5c96f --- /dev/null +++ b/lib/Models/PageComplaint.php @@ -0,0 +1,809 @@ + + */ +class PageComplaint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageComplaint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\Complaint[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\Complaint[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\Complaint[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageContactProjection.php b/lib/Models/PageContactProjection.php new file mode 100644 index 00000000..e99b8fbc --- /dev/null +++ b/lib/Models/PageContactProjection.php @@ -0,0 +1,809 @@ + + */ +class PageContactProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageContactProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\ContactProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\ContactProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\ContactProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageDeliveryStatus.php b/lib/Models/PageDeliveryStatus.php new file mode 100644 index 00000000..4683fe01 --- /dev/null +++ b/lib/Models/PageDeliveryStatus.php @@ -0,0 +1,809 @@ + + */ +class PageDeliveryStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageDeliveryStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\DeliveryStatusDto[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\DeliveryStatusDto[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\DeliveryStatusDto[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageEmailPreview.php b/lib/Models/PageEmailPreview.php new file mode 100644 index 00000000..900c8b9d --- /dev/null +++ b/lib/Models/PageEmailPreview.php @@ -0,0 +1,809 @@ + + */ +class PageEmailPreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageEmailPreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\EmailPreview[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\EmailPreview[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\EmailPreview[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageEmailProjection.php b/lib/Models/PageEmailProjection.php new file mode 100644 index 00000000..4a66cf18 --- /dev/null +++ b/lib/Models/PageEmailProjection.php @@ -0,0 +1,809 @@ + + */ +class PageEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\EmailProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\EmailProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\EmailProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageEmailValidationRequest.php b/lib/Models/PageEmailValidationRequest.php new file mode 100644 index 00000000..761ed18b --- /dev/null +++ b/lib/Models/PageEmailValidationRequest.php @@ -0,0 +1,809 @@ + + */ +class PageEmailValidationRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageEmailValidationRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\EmailValidationRequestDto[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\EmailValidationRequestDto[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\EmailValidationRequestDto[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageExpiredInboxRecordProjection.php b/lib/Models/PageExpiredInboxRecordProjection.php new file mode 100644 index 00000000..efd21297 --- /dev/null +++ b/lib/Models/PageExpiredInboxRecordProjection.php @@ -0,0 +1,809 @@ + + */ +class PageExpiredInboxRecordProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageExpiredInboxRecordProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\ExpiredInboxRecordProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\ExpiredInboxRecordProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\ExpiredInboxRecordProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageGroupProjection.php b/lib/Models/PageGroupProjection.php new file mode 100644 index 00000000..2e619889 --- /dev/null +++ b/lib/Models/PageGroupProjection.php @@ -0,0 +1,809 @@ + + */ +class PageGroupProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageGroupProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\GroupProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\GroupProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\GroupProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageInboxForwarderDto.php b/lib/Models/PageInboxForwarderDto.php new file mode 100644 index 00000000..77bbc817 --- /dev/null +++ b/lib/Models/PageInboxForwarderDto.php @@ -0,0 +1,809 @@ + + */ +class PageInboxForwarderDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageInboxForwarderDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\InboxForwarderDto[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\InboxForwarderDto[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\InboxForwarderDto[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageInboxForwarderEvents.php b/lib/Models/PageInboxForwarderEvents.php new file mode 100644 index 00000000..bbd60eba --- /dev/null +++ b/lib/Models/PageInboxForwarderEvents.php @@ -0,0 +1,809 @@ + + */ +class PageInboxForwarderEvents implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageInboxForwarderEvents'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\InboxForwarderEventProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\InboxForwarderEventProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\InboxForwarderEventProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageInboxProjection.php b/lib/Models/PageInboxProjection.php new file mode 100644 index 00000000..36314e18 --- /dev/null +++ b/lib/Models/PageInboxProjection.php @@ -0,0 +1,809 @@ + + */ +class PageInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageInboxProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\InboxPreview[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\InboxPreview[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\InboxPreview[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageInboxRulesetDto.php b/lib/Models/PageInboxRulesetDto.php new file mode 100644 index 00000000..bdac89a7 --- /dev/null +++ b/lib/Models/PageInboxRulesetDto.php @@ -0,0 +1,809 @@ + + */ +class PageInboxRulesetDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageInboxRulesetDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\InboxRulesetDto[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\InboxRulesetDto[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\InboxRulesetDto[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageListUnsubscribeRecipients.php b/lib/Models/PageListUnsubscribeRecipients.php new file mode 100644 index 00000000..9775029c --- /dev/null +++ b/lib/Models/PageListUnsubscribeRecipients.php @@ -0,0 +1,809 @@ + + */ +class PageListUnsubscribeRecipients implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageListUnsubscribeRecipients'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\ListUnsubscribeRecipientProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\ListUnsubscribeRecipientProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\ListUnsubscribeRecipientProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageMissedEmailProjection.php b/lib/Models/PageMissedEmailProjection.php new file mode 100644 index 00000000..07b11b49 --- /dev/null +++ b/lib/Models/PageMissedEmailProjection.php @@ -0,0 +1,809 @@ + + */ +class PageMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageMissedEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\MissedEmailProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\MissedEmailProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\MissedEmailProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageOrganizationInboxProjection.php b/lib/Models/PageOrganizationInboxProjection.php new file mode 100644 index 00000000..401b5398 --- /dev/null +++ b/lib/Models/PageOrganizationInboxProjection.php @@ -0,0 +1,809 @@ + + */ +class PageOrganizationInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageOrganizationInboxProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\OrganizationInboxProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\OrganizationInboxProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\OrganizationInboxProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PagePhoneNumberProjection.php b/lib/Models/PagePhoneNumberProjection.php new file mode 100644 index 00000000..f2697a26 --- /dev/null +++ b/lib/Models/PagePhoneNumberProjection.php @@ -0,0 +1,809 @@ + + */ +class PagePhoneNumberProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PagePhoneNumberProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\PhoneNumberProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\PhoneNumberProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\PhoneNumberProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageScheduledJobs.php b/lib/Models/PageScheduledJobs.php new file mode 100644 index 00000000..2ccb4afa --- /dev/null +++ b/lib/Models/PageScheduledJobs.php @@ -0,0 +1,809 @@ + + */ +class PageScheduledJobs implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageScheduledJobs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\ScheduledJob[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\ScheduledJob[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\ScheduledJob[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageSentEmailProjection.php b/lib/Models/PageSentEmailProjection.php new file mode 100644 index 00000000..52b6f835 --- /dev/null +++ b/lib/Models/PageSentEmailProjection.php @@ -0,0 +1,827 @@ + + */ +class PageSentEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageSentEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\SentEmailProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'size' => 'int', + 'number' => 'int', + 'number_of_elements' => 'int', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'last' => 'bool', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'size' => 'int32', + 'number' => 'int32', + 'number_of_elements' => 'int32', + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'last' => null, + 'sort' => null, + 'first' => null, + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'size' => false, + 'number' => false, + 'number_of_elements' => false, + 'total_elements' => false, + 'total_pages' => false, + 'last' => false, + 'sort' => false, + 'first' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'size' => 'size', + 'number' => 'number', + 'number_of_elements' => 'numberOfElements', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'last' => 'last', + 'sort' => 'sort', + 'first' => 'first', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'size' => 'setSize', + 'number' => 'setNumber', + 'number_of_elements' => 'setNumberOfElements', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'last' => 'setLast', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'size' => 'getSize', + 'number' => 'getNumber', + 'number_of_elements' => 'getNumberOfElements', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'last' => 'getLast', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } + if ($this->container['number'] === null) { + $invalidProperties[] = "'number' can't be null"; + } + if ($this->container['number_of_elements'] === null) { + $invalidProperties[] = "'number_of_elements' can't be null"; + } + if ($this->container['total_elements'] === null) { + $invalidProperties[] = "'total_elements' can't be null"; + } + if ($this->container['total_pages'] === null) { + $invalidProperties[] = "'total_pages' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\SentEmailProjection[] + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\SentEmailProjection[] $content Collection of items + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets size + * + * @return int + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int $size Size of page requested + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int $number Page number starting at 0 + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int $number_of_elements Number of items returned + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets total_elements + * + * @return int + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int $total_elements Total number of items available for querying + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int $total_pages Total number of pages available + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageSentEmailWithQueueProjection.php b/lib/Models/PageSentEmailWithQueueProjection.php new file mode 100644 index 00000000..facd67f3 --- /dev/null +++ b/lib/Models/PageSentEmailWithQueueProjection.php @@ -0,0 +1,827 @@ + + */ +class PageSentEmailWithQueueProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageSentEmailWithQueueProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\SendWithQueueResult[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'size' => 'int', + 'number' => 'int', + 'number_of_elements' => 'int', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'last' => 'bool', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'size' => 'int32', + 'number' => 'int32', + 'number_of_elements' => 'int32', + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'last' => null, + 'sort' => null, + 'first' => null, + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'size' => false, + 'number' => false, + 'number_of_elements' => false, + 'total_elements' => false, + 'total_pages' => false, + 'last' => false, + 'sort' => false, + 'first' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'size' => 'size', + 'number' => 'number', + 'number_of_elements' => 'numberOfElements', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'last' => 'last', + 'sort' => 'sort', + 'first' => 'first', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'size' => 'setSize', + 'number' => 'setNumber', + 'number_of_elements' => 'setNumberOfElements', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'last' => 'setLast', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'size' => 'getSize', + 'number' => 'getNumber', + 'number_of_elements' => 'getNumberOfElements', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'last' => 'getLast', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } + if ($this->container['number'] === null) { + $invalidProperties[] = "'number' can't be null"; + } + if ($this->container['number_of_elements'] === null) { + $invalidProperties[] = "'number_of_elements' can't be null"; + } + if ($this->container['total_elements'] === null) { + $invalidProperties[] = "'total_elements' can't be null"; + } + if ($this->container['total_pages'] === null) { + $invalidProperties[] = "'total_pages' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\SendWithQueueResult[] + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\SendWithQueueResult[] $content Collection of items + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets size + * + * @return int + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int $size Size of page requested + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int $number Page number starting at 0 + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int $number_of_elements Number of items returned + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets total_elements + * + * @return int + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int $total_elements Total number of items available for querying + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int $total_pages Total number of pages available + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageSmsProjection.php b/lib/Models/PageSmsProjection.php new file mode 100644 index 00000000..c33cfbf5 --- /dev/null +++ b/lib/Models/PageSmsProjection.php @@ -0,0 +1,809 @@ + + */ +class PageSmsProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageSmsProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\SmsProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\SmsProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\SmsProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageTemplateProjection.php b/lib/Models/PageTemplateProjection.php new file mode 100644 index 00000000..6f07165d --- /dev/null +++ b/lib/Models/PageTemplateProjection.php @@ -0,0 +1,809 @@ + + */ +class PageTemplateProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageTemplateProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\TemplateProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\TemplateProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\TemplateProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageThreadProjection.php b/lib/Models/PageThreadProjection.php new file mode 100644 index 00000000..7371b73b --- /dev/null +++ b/lib/Models/PageThreadProjection.php @@ -0,0 +1,809 @@ + + */ +class PageThreadProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageThreadProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\ThreadProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\ThreadProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\ThreadProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageTrackingPixelProjection.php b/lib/Models/PageTrackingPixelProjection.php new file mode 100644 index 00000000..3634de37 --- /dev/null +++ b/lib/Models/PageTrackingPixelProjection.php @@ -0,0 +1,809 @@ + + */ +class PageTrackingPixelProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageTrackingPixelProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\TrackingPixelProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\TrackingPixelProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\TrackingPixelProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageUnknownMissedEmailProjection.php b/lib/Models/PageUnknownMissedEmailProjection.php new file mode 100644 index 00000000..3e30bc34 --- /dev/null +++ b/lib/Models/PageUnknownMissedEmailProjection.php @@ -0,0 +1,809 @@ + + */ +class PageUnknownMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageUnknownMissedEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\UnknownMissedEmailProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\UnknownMissedEmailProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\UnknownMissedEmailProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageWebhookProjection.php b/lib/Models/PageWebhookProjection.php new file mode 100644 index 00000000..98661a84 --- /dev/null +++ b/lib/Models/PageWebhookProjection.php @@ -0,0 +1,809 @@ + + */ +class PageWebhookProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageWebhookProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\WebhookProjection[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\WebhookProjection[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\WebhookProjection[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageWebhookResult.php b/lib/Models/PageWebhookResult.php new file mode 100644 index 00000000..bec8e03c --- /dev/null +++ b/lib/Models/PageWebhookResult.php @@ -0,0 +1,809 @@ + + */ +class PageWebhookResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageWebhookResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\MailSlurp\Models\WebhookResultDto[]', + 'pageable' => '\MailSlurp\Models\PageableObject', + 'total' => 'int', + 'last' => 'bool', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'size' => 'int', + 'number' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'first' => 'bool', + 'number_of_elements' => 'int', + 'empty' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pageable' => null, + 'total' => 'int64', + 'last' => null, + 'total_elements' => 'int64', + 'total_pages' => 'int32', + 'size' => 'int32', + 'number' => 'int32', + 'sort' => null, + 'first' => null, + 'number_of_elements' => 'int32', + 'empty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pageable' => false, + 'total' => false, + 'last' => false, + 'total_elements' => false, + 'total_pages' => false, + 'size' => false, + 'number' => false, + 'sort' => false, + 'first' => false, + 'number_of_elements' => false, + 'empty' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pageable' => 'pageable', + 'total' => 'total', + 'last' => 'last', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'size' => 'size', + 'number' => 'number', + 'sort' => 'sort', + 'first' => 'first', + 'number_of_elements' => 'numberOfElements', + 'empty' => 'empty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pageable' => 'setPageable', + 'total' => 'setTotal', + 'last' => 'setLast', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'size' => 'setSize', + 'number' => 'setNumber', + 'sort' => 'setSort', + 'first' => 'setFirst', + 'number_of_elements' => 'setNumberOfElements', + 'empty' => 'setEmpty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pageable' => 'getPageable', + 'total' => 'getTotal', + 'last' => 'getLast', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'size' => 'getSize', + 'number' => 'getNumber', + 'sort' => 'getSort', + 'first' => 'getFirst', + 'number_of_elements' => 'getNumberOfElements', + 'empty' => 'getEmpty' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pageable', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('number_of_elements', $data ?? [], null); + $this->setIfExists('empty', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \MailSlurp\Models\WebhookResultDto[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \MailSlurp\Models\WebhookResultDto[]|null $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pageable + * + * @return \MailSlurp\Models\PageableObject|null + */ + public function getPageable() + { + return $this->container['pageable']; + } + + /** + * Sets pageable + * + * @param \MailSlurp\Models\PageableObject|null $pageable pageable + * + * @return self + */ + public function setPageable($pageable) + { + + if (is_null($pageable)) { + throw new \InvalidArgumentException('non-nullable pageable cannot be null'); + } + + $this->container['pageable'] = $pageable; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets last + * + * @return bool|null + */ + public function getLast() + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param bool|null $last last + * + * @return self + */ + public function setLast($last) + { + + if (is_null($last)) { + throw new \InvalidArgumentException('non-nullable last cannot be null'); + } + + $this->container['last'] = $last; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements() + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements total_elements + * + * @return self + */ + public function setTotalElements($total_elements) + { + + if (is_null($total_elements)) { + throw new \InvalidArgumentException('non-nullable total_elements cannot be null'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets number + * + * @return int|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param int|null $number number + * + * @return self + */ + public function setNumber($number) + { + + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets first + * + * @return bool|null + */ + public function getFirst() + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param bool|null $first first + * + * @return self + */ + public function setFirst($first) + { + + if (is_null($first)) { + throw new \InvalidArgumentException('non-nullable first cannot be null'); + } + + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets number_of_elements + * + * @return int|null + */ + public function getNumberOfElements() + { + return $this->container['number_of_elements']; + } + + /** + * Sets number_of_elements + * + * @param int|null $number_of_elements number_of_elements + * + * @return self + */ + public function setNumberOfElements($number_of_elements) + { + + if (is_null($number_of_elements)) { + throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null'); + } + + $this->container['number_of_elements'] = $number_of_elements; + + return $this; + } + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PageableObject.php b/lib/Models/PageableObject.php new file mode 100644 index 00000000..62f9f615 --- /dev/null +++ b/lib/Models/PageableObject.php @@ -0,0 +1,592 @@ + + */ +class PageableObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PageableObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'offset' => 'int', + 'sort' => '\MailSlurp\Models\Sort', + 'page_number' => 'int', + 'page_size' => 'int', + 'paged' => 'bool', + 'unpaged' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'offset' => 'int64', + 'sort' => null, + 'page_number' => 'int32', + 'page_size' => 'int32', + 'paged' => null, + 'unpaged' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'offset' => false, + 'sort' => false, + 'page_number' => false, + 'page_size' => false, + 'paged' => false, + 'unpaged' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'offset' => 'offset', + 'sort' => 'sort', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'paged' => 'paged', + 'unpaged' => 'unpaged' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'offset' => 'setOffset', + 'sort' => 'setSort', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'paged' => 'setPaged', + 'unpaged' => 'setUnpaged' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'offset' => 'getOffset', + 'sort' => 'getSort', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'paged' => 'getPaged', + 'unpaged' => 'getUnpaged' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('offset', $data ?? [], null); + $this->setIfExists('sort', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('paged', $data ?? [], null); + $this->setIfExists('unpaged', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset offset + * + * @return self + */ + public function setOffset($offset) + { + + if (is_null($offset)) { + throw new \InvalidArgumentException('non-nullable offset cannot be null'); + } + + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets sort + * + * @return \MailSlurp\Models\Sort|null + */ + public function getSort() + { + return $this->container['sort']; + } + + /** + * Sets sort + * + * @param \MailSlurp\Models\Sort|null $sort sort + * + * @return self + */ + public function setSort($sort) + { + + if (is_null($sort)) { + throw new \InvalidArgumentException('non-nullable sort cannot be null'); + } + + $this->container['sort'] = $sort; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets paged + * + * @return bool|null + */ + public function getPaged() + { + return $this->container['paged']; + } + + /** + * Sets paged + * + * @param bool|null $paged paged + * + * @return self + */ + public function setPaged($paged) + { + + if (is_null($paged)) { + throw new \InvalidArgumentException('non-nullable paged cannot be null'); + } + + $this->container['paged'] = $paged; + + return $this; + } + + /** + * Gets unpaged + * + * @return bool|null + */ + public function getUnpaged() + { + return $this->container['unpaged']; + } + + /** + * Sets unpaged + * + * @param bool|null $unpaged unpaged + * + * @return self + */ + public function setUnpaged($unpaged) + { + + if (is_null($unpaged)) { + throw new \InvalidArgumentException('non-nullable unpaged cannot be null'); + } + + $this->container['unpaged'] = $unpaged; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PhoneNumberDto.php b/lib/Models/PhoneNumberDto.php new file mode 100644 index 00000000..6f3dc110 --- /dev/null +++ b/lib/Models/PhoneNumberDto.php @@ -0,0 +1,755 @@ + + */ +class PhoneNumberDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PhoneNumberDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'compliance_address' => 'string', + 'emergency_address' => 'string', + 'phone_number' => 'string', + 'phone_country' => 'string', + 'phone_plan' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'compliance_address' => 'uuid', + 'emergency_address' => 'uuid', + 'phone_number' => null, + 'phone_country' => null, + 'phone_plan' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'compliance_address' => false, + 'emergency_address' => false, + 'phone_number' => false, + 'phone_country' => false, + 'phone_plan' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'compliance_address' => 'complianceAddress', + 'emergency_address' => 'emergencyAddress', + 'phone_number' => 'phoneNumber', + 'phone_country' => 'phoneCountry', + 'phone_plan' => 'phonePlan', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'compliance_address' => 'setComplianceAddress', + 'emergency_address' => 'setEmergencyAddress', + 'phone_number' => 'setPhoneNumber', + 'phone_country' => 'setPhoneCountry', + 'phone_plan' => 'setPhonePlan', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'compliance_address' => 'getComplianceAddress', + 'emergency_address' => 'getEmergencyAddress', + 'phone_number' => 'getPhoneNumber', + 'phone_country' => 'getPhoneCountry', + 'phone_plan' => 'getPhonePlan', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const PHONE_COUNTRY_US = 'US'; + public const PHONE_COUNTRY_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPhoneCountryAllowableValues() + { + return [ + self::PHONE_COUNTRY_US, + self::PHONE_COUNTRY_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('compliance_address', $data ?? [], null); + $this->setIfExists('emergency_address', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('phone_country', $data ?? [], null); + $this->setIfExists('phone_plan', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['phone_country'] === null) { + $invalidProperties[] = "'phone_country' can't be null"; + } + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'phone_country', must be one of '%s'", + $this->container['phone_country'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['phone_plan'] === null) { + $invalidProperties[] = "'phone_plan' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets compliance_address + * + * @return string|null + */ + public function getComplianceAddress() + { + return $this->container['compliance_address']; + } + + /** + * Sets compliance_address + * + * @param string|null $compliance_address compliance_address + * + * @return self + */ + public function setComplianceAddress($compliance_address) + { + + if (is_null($compliance_address)) { + throw new \InvalidArgumentException('non-nullable compliance_address cannot be null'); + } + + $this->container['compliance_address'] = $compliance_address; + + return $this; + } + + /** + * Gets emergency_address + * + * @return string|null + */ + public function getEmergencyAddress() + { + return $this->container['emergency_address']; + } + + /** + * Sets emergency_address + * + * @param string|null $emergency_address emergency_address + * + * @return self + */ + public function setEmergencyAddress($emergency_address) + { + + if (is_null($emergency_address)) { + throw new \InvalidArgumentException('non-nullable emergency_address cannot be null'); + } + + $this->container['emergency_address'] = $emergency_address; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number phone_number + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets phone_country + * + * @return string + */ + public function getPhoneCountry() + { + return $this->container['phone_country']; + } + + /** + * Sets phone_country + * + * @param string $phone_country phone_country + * + * @return self + */ + public function setPhoneCountry($phone_country) + { + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!in_array($phone_country, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'phone_country', must be one of '%s'", + $phone_country, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($phone_country)) { + throw new \InvalidArgumentException('non-nullable phone_country cannot be null'); + } + + $this->container['phone_country'] = $phone_country; + + return $this; + } + + /** + * Gets phone_plan + * + * @return string + */ + public function getPhonePlan() + { + return $this->container['phone_plan']; + } + + /** + * Sets phone_plan + * + * @param string $phone_plan phone_plan + * + * @return self + */ + public function setPhonePlan($phone_plan) + { + + if (is_null($phone_plan)) { + throw new \InvalidArgumentException('non-nullable phone_plan cannot be null'); + } + + $this->container['phone_plan'] = $phone_plan; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PhoneNumberProjection.php b/lib/Models/PhoneNumberProjection.php new file mode 100644 index 00000000..19196fa3 --- /dev/null +++ b/lib/Models/PhoneNumberProjection.php @@ -0,0 +1,606 @@ + + */ +class PhoneNumberProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PhoneNumberProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'phone_number' => 'string', + 'phone_country' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'phone_number' => null, + 'phone_country' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'created_at' => false, + 'phone_number' => false, + 'phone_country' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'phone_number' => 'phoneNumber', + 'phone_country' => 'phoneCountry' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'phone_number' => 'setPhoneNumber', + 'phone_country' => 'setPhoneCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'phone_number' => 'getPhoneNumber', + 'phone_country' => 'getPhoneCountry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const PHONE_COUNTRY_US = 'US'; + public const PHONE_COUNTRY_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPhoneCountryAllowableValues() + { + return [ + self::PHONE_COUNTRY_US, + self::PHONE_COUNTRY_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('phone_country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['phone_country'] === null) { + $invalidProperties[] = "'phone_country' can't be null"; + } + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'phone_country', must be one of '%s'", + $this->container['phone_country'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number phone_number + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets phone_country + * + * @return string + */ + public function getPhoneCountry() + { + return $this->container['phone_country']; + } + + /** + * Sets phone_country + * + * @param string $phone_country phone_country + * + * @return self + */ + public function setPhoneCountry($phone_country) + { + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!in_array($phone_country, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'phone_country', must be one of '%s'", + $phone_country, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($phone_country)) { + throw new \InvalidArgumentException('non-nullable phone_country cannot be null'); + } + + $this->container['phone_country'] = $phone_country; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/PhonePlanDto.php b/lib/Models/PhonePlanDto.php new file mode 100644 index 00000000..6df15347 --- /dev/null +++ b/lib/Models/PhonePlanDto.php @@ -0,0 +1,566 @@ + + */ +class PhonePlanDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PhonePlanDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'phone_country' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'phone_country' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'phone_country' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'phone_country' => 'phoneCountry', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'phone_country' => 'setPhoneCountry', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'phone_country' => 'getPhoneCountry', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const PHONE_COUNTRY_US = 'US'; + public const PHONE_COUNTRY_GB = 'GB'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPhoneCountryAllowableValues() + { + return [ + self::PHONE_COUNTRY_US, + self::PHONE_COUNTRY_GB, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('phone_country', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['phone_country'] === null) { + $invalidProperties[] = "'phone_country' can't be null"; + } + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'phone_country', must be one of '%s'", + $this->container['phone_country'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets phone_country + * + * @return string + */ + public function getPhoneCountry() + { + return $this->container['phone_country']; + } + + /** + * Sets phone_country + * + * @param string $phone_country phone_country + * + * @return self + */ + public function setPhoneCountry($phone_country) + { + $allowedValues = $this->getPhoneCountryAllowableValues(); + if (!in_array($phone_country, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'phone_country', must be one of '%s'", + $phone_country, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($phone_country)) { + throw new \InvalidArgumentException('non-nullable phone_country cannot be null'); + } + + $this->container['phone_country'] = $phone_country; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/RawEmailJson.php b/lib/Models/RawEmailJson.php new file mode 100644 index 00000000..ed8061da --- /dev/null +++ b/lib/Models/RawEmailJson.php @@ -0,0 +1,416 @@ + + */ +class RawEmailJson implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RawEmailJson'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return string + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string $content content + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/Recipient.php b/lib/Models/Recipient.php new file mode 100644 index 00000000..dc7e3510 --- /dev/null +++ b/lib/Models/Recipient.php @@ -0,0 +1,498 @@ + + */ +class Recipient implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Recipient'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'raw_value' => 'string', + 'email_address' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'raw_value' => null, + 'email_address' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'raw_value' => false, + 'email_address' => false, + 'name' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'raw_value' => 'rawValue', + 'email_address' => 'emailAddress', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'raw_value' => 'setRawValue', + 'email_address' => 'setEmailAddress', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'raw_value' => 'getRawValue', + 'email_address' => 'getEmailAddress', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('raw_value', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['raw_value'] === null) { + $invalidProperties[] = "'raw_value' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets raw_value + * + * @return string + */ + public function getRawValue() + { + return $this->container['raw_value']; + } + + /** + * Sets raw_value + * + * @param string $raw_value raw_value + * + * @return self + */ + public function setRawValue($raw_value) + { + + if (is_null($raw_value)) { + throw new \InvalidArgumentException('non-nullable raw_value cannot be null'); + } + + $this->container['raw_value'] = $raw_value; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ReplyToAliasEmailOptions.php b/lib/Models/ReplyToAliasEmailOptions.php new file mode 100644 index 00000000..3d55d58c --- /dev/null +++ b/lib/Models/ReplyToAliasEmailOptions.php @@ -0,0 +1,781 @@ + + */ +class ReplyToAliasEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReplyToAliasEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'string', + 'is_html' => 'bool', + 'charset' => 'string', + 'attachments' => 'string[]', + 'template_variables' => 'array', + 'template' => 'string', + 'send_strategy' => 'string', + 'use_inbox_name' => 'bool', + 'html' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'is_html' => null, + 'charset' => null, + 'attachments' => null, + 'template_variables' => null, + 'template' => 'uuid', + 'send_strategy' => null, + 'use_inbox_name' => null, + 'html' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'is_html' => false, + 'charset' => true, + 'attachments' => true, + 'template_variables' => true, + 'template' => true, + 'send_strategy' => true, + 'use_inbox_name' => true, + 'html' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'is_html' => 'isHTML', + 'charset' => 'charset', + 'attachments' => 'attachments', + 'template_variables' => 'templateVariables', + 'template' => 'template', + 'send_strategy' => 'sendStrategy', + 'use_inbox_name' => 'useInboxName', + 'html' => 'html' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'is_html' => 'setIsHtml', + 'charset' => 'setCharset', + 'attachments' => 'setAttachments', + 'template_variables' => 'setTemplateVariables', + 'template' => 'setTemplate', + 'send_strategy' => 'setSendStrategy', + 'use_inbox_name' => 'setUseInboxName', + 'html' => 'setHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'is_html' => 'getIsHtml', + 'charset' => 'getCharset', + 'attachments' => 'getAttachments', + 'template_variables' => 'getTemplateVariables', + 'template' => 'getTemplate', + 'send_strategy' => 'getSendStrategy', + 'use_inbox_name' => 'getUseInboxName', + 'html' => 'getHtml' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSendStrategyAllowableValues() + { + return [ + self::SEND_STRATEGY_SINGLE_MESSAGE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('is_html', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('template_variables', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('send_strategy', $data ?? [], null); + $this->setIfExists('use_inbox_name', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['is_html'] === null) { + $invalidProperties[] = "'is_html' can't be null"; + } + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'send_strategy', must be one of '%s'", + $this->container['send_strategy'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body Body of the reply email you want to send + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets is_html + * + * @return bool + */ + public function getIsHtml() + { + return $this->container['is_html']; + } + + /** + * Sets is_html + * + * @param bool $is_html Is the reply HTML + * + * @return self + */ + public function setIsHtml($is_html) + { + + if (is_null($is_html)) { + throw new \InvalidArgumentException('non-nullable is_html cannot be null'); + } + + $this->container['is_html'] = $is_html; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset The charset that your message should be sent with. Optional. Default is UTF-8 + * + * @return self + */ + public function setCharset($charset) + { + + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments List of uploaded attachments to send with the reply. Optional. + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets template_variables + * + * @return array|null + */ + public function getTemplateVariables() + { + return $this->container['template_variables']; + } + + /** + * Sets template_variables + * + * @param array|null $template_variables Template variables if using a template + * + * @return self + */ + public function setTemplateVariables($template_variables) + { + + if (is_null($template_variables)) { + array_push($this->openAPINullablesSetToNull, 'template_variables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_variables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template_variables'] = $template_variables; + + return $this; + } + + /** + * Gets template + * + * @return string|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param string|null $template Template ID to use instead of body. Will use template variable map to fill defined variable slots. + * + * @return self + */ + public function setTemplate($template) + { + + if (is_null($template)) { + array_push($this->openAPINullablesSetToNull, 'template'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets send_strategy + * + * @return string|null + */ + public function getSendStrategy() + { + return $this->container['send_strategy']; + } + + /** + * Sets send_strategy + * + * @param string|null $send_strategy How an email should be sent based on its recipients + * + * @return self + */ + public function setSendStrategy($send_strategy) + { + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'send_strategy', must be one of '%s'", + $send_strategy, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($send_strategy)) { + array_push($this->openAPINullablesSetToNull, 'send_strategy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('send_strategy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['send_strategy'] = $send_strategy; + + return $this; + } + + /** + * Gets use_inbox_name + * + * @return bool|null + */ + public function getUseInboxName() + { + return $this->container['use_inbox_name']; + } + + /** + * Sets use_inbox_name + * + * @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address + * + * @return self + */ + public function setUseInboxName($use_inbox_name) + { + + if (is_null($use_inbox_name)) { + array_push($this->openAPINullablesSetToNull, 'use_inbox_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_inbox_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_inbox_name'] = $use_inbox_name; + + return $this; + } + + /** + * Gets html + * + * @return bool|null + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param bool|null $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ReplyToEmailOptions.php b/lib/Models/ReplyToEmailOptions.php new file mode 100644 index 00000000..0859feab --- /dev/null +++ b/lib/Models/ReplyToEmailOptions.php @@ -0,0 +1,867 @@ + + */ +class ReplyToEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReplyToEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'string', + 'is_html' => 'bool', + 'from' => 'string', + 'reply_to' => 'string', + 'charset' => 'string', + 'attachments' => 'string[]', + 'template_variables' => 'array', + 'template' => 'string', + 'send_strategy' => 'string', + 'use_inbox_name' => 'bool', + 'html' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'is_html' => null, + 'from' => null, + 'reply_to' => null, + 'charset' => null, + 'attachments' => null, + 'template_variables' => null, + 'template' => 'uuid', + 'send_strategy' => null, + 'use_inbox_name' => null, + 'html' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'is_html' => false, + 'from' => true, + 'reply_to' => true, + 'charset' => true, + 'attachments' => true, + 'template_variables' => true, + 'template' => true, + 'send_strategy' => true, + 'use_inbox_name' => true, + 'html' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'is_html' => 'isHTML', + 'from' => 'from', + 'reply_to' => 'replyTo', + 'charset' => 'charset', + 'attachments' => 'attachments', + 'template_variables' => 'templateVariables', + 'template' => 'template', + 'send_strategy' => 'sendStrategy', + 'use_inbox_name' => 'useInboxName', + 'html' => 'html' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'is_html' => 'setIsHtml', + 'from' => 'setFrom', + 'reply_to' => 'setReplyTo', + 'charset' => 'setCharset', + 'attachments' => 'setAttachments', + 'template_variables' => 'setTemplateVariables', + 'template' => 'setTemplate', + 'send_strategy' => 'setSendStrategy', + 'use_inbox_name' => 'setUseInboxName', + 'html' => 'setHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'is_html' => 'getIsHtml', + 'from' => 'getFrom', + 'reply_to' => 'getReplyTo', + 'charset' => 'getCharset', + 'attachments' => 'getAttachments', + 'template_variables' => 'getTemplateVariables', + 'template' => 'getTemplate', + 'send_strategy' => 'getSendStrategy', + 'use_inbox_name' => 'getUseInboxName', + 'html' => 'getHtml' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSendStrategyAllowableValues() + { + return [ + self::SEND_STRATEGY_SINGLE_MESSAGE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('is_html', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('template_variables', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('send_strategy', $data ?? [], null); + $this->setIfExists('use_inbox_name', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['is_html'] === null) { + $invalidProperties[] = "'is_html' can't be null"; + } + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'send_strategy', must be one of '%s'", + $this->container['send_strategy'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body Body of the reply email you want to send + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets is_html + * + * @return bool + */ + public function getIsHtml() + { + return $this->container['is_html']; + } + + /** + * Sets is_html + * + * @param bool $is_html Is the reply HTML + * + * @return self + */ + public function setIsHtml($is_html) + { + + if (is_null($is_html)) { + throw new \InvalidArgumentException('non-nullable is_html cannot be null'); + } + + $this->container['is_html'] = $is_html; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The from header that should be used. Optional + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo() + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to The replyTo header that should be used. Optional + * + * @return self + */ + public function setReplyTo($reply_to) + { + + if (is_null($reply_to)) { + array_push($this->openAPINullablesSetToNull, 'reply_to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reply_to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset The charset that your message should be sent with. Optional. Default is UTF-8 + * + * @return self + */ + public function setCharset($charset) + { + + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments List of uploaded attachments to send with the reply. Optional. + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets template_variables + * + * @return array|null + */ + public function getTemplateVariables() + { + return $this->container['template_variables']; + } + + /** + * Sets template_variables + * + * @param array|null $template_variables Template variables if using a template + * + * @return self + */ + public function setTemplateVariables($template_variables) + { + + if (is_null($template_variables)) { + array_push($this->openAPINullablesSetToNull, 'template_variables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_variables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template_variables'] = $template_variables; + + return $this; + } + + /** + * Gets template + * + * @return string|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param string|null $template Template ID to use instead of body. Will use template variable map to fill defined variable slots. + * + * @return self + */ + public function setTemplate($template) + { + + if (is_null($template)) { + array_push($this->openAPINullablesSetToNull, 'template'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets send_strategy + * + * @return string|null + */ + public function getSendStrategy() + { + return $this->container['send_strategy']; + } + + /** + * Sets send_strategy + * + * @param string|null $send_strategy How an email should be sent based on its recipients + * + * @return self + */ + public function setSendStrategy($send_strategy) + { + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'send_strategy', must be one of '%s'", + $send_strategy, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($send_strategy)) { + array_push($this->openAPINullablesSetToNull, 'send_strategy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('send_strategy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['send_strategy'] = $send_strategy; + + return $this; + } + + /** + * Gets use_inbox_name + * + * @return bool|null + */ + public function getUseInboxName() + { + return $this->container['use_inbox_name']; + } + + /** + * Sets use_inbox_name + * + * @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address + * + * @return self + */ + public function setUseInboxName($use_inbox_name) + { + + if (is_null($use_inbox_name)) { + array_push($this->openAPINullablesSetToNull, 'use_inbox_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_inbox_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_inbox_name'] = $use_inbox_name; + + return $this; + } + + /** + * Gets html + * + * @return bool|null + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param bool|null $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ScheduledJob.php b/lib/Models/ScheduledJob.php new file mode 100644 index 00000000..8483b406 --- /dev/null +++ b/lib/Models/ScheduledJob.php @@ -0,0 +1,804 @@ + + */ +class ScheduledJob implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ScheduledJob'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'job_id' => 'string', + 'group_id' => 'string', + 'trigger_id' => 'string', + 'status' => 'string', + 'send_at_timestamp' => '\DateTime', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'job_id' => null, + 'group_id' => null, + 'trigger_id' => null, + 'status' => null, + 'send_at_timestamp' => 'date-time', + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'inbox_id' => false, + 'job_id' => false, + 'group_id' => false, + 'trigger_id' => false, + 'status' => false, + 'send_at_timestamp' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'job_id' => 'jobId', + 'group_id' => 'groupId', + 'trigger_id' => 'triggerId', + 'status' => 'status', + 'send_at_timestamp' => 'sendAtTimestamp', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'job_id' => 'setJobId', + 'group_id' => 'setGroupId', + 'trigger_id' => 'setTriggerId', + 'status' => 'setStatus', + 'send_at_timestamp' => 'setSendAtTimestamp', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'job_id' => 'getJobId', + 'group_id' => 'getGroupId', + 'trigger_id' => 'getTriggerId', + 'status' => 'getStatus', + 'send_at_timestamp' => 'getSendAtTimestamp', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUBMITTED = 'SUBMITTED'; + public const STATUS_COMPLETED = 'COMPLETED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_CANCELLED = 'CANCELLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUBMITTED, + self::STATUS_COMPLETED, + self::STATUS_FAILED, + self::STATUS_CANCELLED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('job_id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('trigger_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('send_at_timestamp', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['job_id'] === null) { + $invalidProperties[] = "'job_id' can't be null"; + } + if ($this->container['group_id'] === null) { + $invalidProperties[] = "'group_id' can't be null"; + } + if ($this->container['trigger_id'] === null) { + $invalidProperties[] = "'trigger_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['send_at_timestamp'] === null) { + $invalidProperties[] = "'send_at_timestamp' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets job_id + * + * @return string + */ + public function getJobId() + { + return $this->container['job_id']; + } + + /** + * Sets job_id + * + * @param string $job_id job_id + * + * @return self + */ + public function setJobId($job_id) + { + + if (is_null($job_id)) { + throw new \InvalidArgumentException('non-nullable job_id cannot be null'); + } + + $this->container['job_id'] = $job_id; + + return $this; + } + + /** + * Gets group_id + * + * @return string + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string $group_id group_id + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + throw new \InvalidArgumentException('non-nullable group_id cannot be null'); + } + + $this->container['group_id'] = $group_id; + + return $this; + } + + /** + * Gets trigger_id + * + * @return string + */ + public function getTriggerId() + { + return $this->container['trigger_id']; + } + + /** + * Sets trigger_id + * + * @param string $trigger_id trigger_id + * + * @return self + */ + public function setTriggerId($trigger_id) + { + + if (is_null($trigger_id)) { + throw new \InvalidArgumentException('non-nullable trigger_id cannot be null'); + } + + $this->container['trigger_id'] = $trigger_id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets send_at_timestamp + * + * @return \DateTime + */ + public function getSendAtTimestamp() + { + return $this->container['send_at_timestamp']; + } + + /** + * Sets send_at_timestamp + * + * @param \DateTime $send_at_timestamp send_at_timestamp + * + * @return self + */ + public function setSendAtTimestamp($send_at_timestamp) + { + + if (is_null($send_at_timestamp)) { + throw new \InvalidArgumentException('non-nullable send_at_timestamp cannot be null'); + } + + $this->container['send_at_timestamp'] = $send_at_timestamp; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ScheduledJobDto.php b/lib/Models/ScheduledJobDto.php new file mode 100644 index 00000000..0f99f1e6 --- /dev/null +++ b/lib/Models/ScheduledJobDto.php @@ -0,0 +1,804 @@ + + */ +class ScheduledJobDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ScheduledJobDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'job_id' => 'string', + 'group_id' => 'string', + 'trigger_id' => 'string', + 'status' => 'string', + 'send_at_timestamp' => '\DateTime', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'job_id' => null, + 'group_id' => null, + 'trigger_id' => null, + 'status' => null, + 'send_at_timestamp' => 'date-time', + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'inbox_id' => false, + 'job_id' => false, + 'group_id' => false, + 'trigger_id' => false, + 'status' => false, + 'send_at_timestamp' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'job_id' => 'jobId', + 'group_id' => 'groupId', + 'trigger_id' => 'triggerId', + 'status' => 'status', + 'send_at_timestamp' => 'sendAtTimestamp', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'job_id' => 'setJobId', + 'group_id' => 'setGroupId', + 'trigger_id' => 'setTriggerId', + 'status' => 'setStatus', + 'send_at_timestamp' => 'setSendAtTimestamp', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'job_id' => 'getJobId', + 'group_id' => 'getGroupId', + 'trigger_id' => 'getTriggerId', + 'status' => 'getStatus', + 'send_at_timestamp' => 'getSendAtTimestamp', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUBMITTED = 'SUBMITTED'; + public const STATUS_COMPLETED = 'COMPLETED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_CANCELLED = 'CANCELLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUBMITTED, + self::STATUS_COMPLETED, + self::STATUS_FAILED, + self::STATUS_CANCELLED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('job_id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('trigger_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('send_at_timestamp', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['job_id'] === null) { + $invalidProperties[] = "'job_id' can't be null"; + } + if ($this->container['group_id'] === null) { + $invalidProperties[] = "'group_id' can't be null"; + } + if ($this->container['trigger_id'] === null) { + $invalidProperties[] = "'trigger_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['send_at_timestamp'] === null) { + $invalidProperties[] = "'send_at_timestamp' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets job_id + * + * @return string + */ + public function getJobId() + { + return $this->container['job_id']; + } + + /** + * Sets job_id + * + * @param string $job_id job_id + * + * @return self + */ + public function setJobId($job_id) + { + + if (is_null($job_id)) { + throw new \InvalidArgumentException('non-nullable job_id cannot be null'); + } + + $this->container['job_id'] = $job_id; + + return $this; + } + + /** + * Gets group_id + * + * @return string + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string $group_id group_id + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + throw new \InvalidArgumentException('non-nullable group_id cannot be null'); + } + + $this->container['group_id'] = $group_id; + + return $this; + } + + /** + * Gets trigger_id + * + * @return string + */ + public function getTriggerId() + { + return $this->container['trigger_id']; + } + + /** + * Sets trigger_id + * + * @param string $trigger_id trigger_id + * + * @return self + */ + public function setTriggerId($trigger_id) + { + + if (is_null($trigger_id)) { + throw new \InvalidArgumentException('non-nullable trigger_id cannot be null'); + } + + $this->container['trigger_id'] = $trigger_id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets send_at_timestamp + * + * @return \DateTime + */ + public function getSendAtTimestamp() + { + return $this->container['send_at_timestamp']; + } + + /** + * Sets send_at_timestamp + * + * @param \DateTime $send_at_timestamp send_at_timestamp + * + * @return self + */ + public function setSendAtTimestamp($send_at_timestamp) + { + + if (is_null($send_at_timestamp)) { + throw new \InvalidArgumentException('non-nullable send_at_timestamp cannot be null'); + } + + $this->container['send_at_timestamp'] = $send_at_timestamp; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SendEmailOptions.php b/lib/Models/SendEmailOptions.php new file mode 100644 index 00000000..992125e8 --- /dev/null +++ b/lib/Models/SendEmailOptions.php @@ -0,0 +1,1305 @@ + + */ +class SendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SendEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_contacts' => 'string[]', + 'to_group' => 'string', + 'to' => 'string[]', + 'from' => 'string', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'subject' => 'string', + 'reply_to' => 'string', + 'body' => 'string', + 'html' => 'bool', + 'is_html' => 'bool', + 'charset' => 'string', + 'attachments' => 'string[]', + 'template_variables' => 'array', + 'template' => 'string', + 'send_strategy' => 'string', + 'use_inbox_name' => 'bool', + 'add_tracking_pixel' => 'bool', + 'filter_bounced_recipients' => 'bool', + 'validate_email_addresses' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_contacts' => 'uuid', + 'to_group' => 'uuid', + 'to' => null, + 'from' => null, + 'cc' => null, + 'bcc' => null, + 'subject' => null, + 'reply_to' => null, + 'body' => null, + 'html' => null, + 'is_html' => null, + 'charset' => null, + 'attachments' => null, + 'template_variables' => null, + 'template' => 'uuid', + 'send_strategy' => null, + 'use_inbox_name' => null, + 'add_tracking_pixel' => null, + 'filter_bounced_recipients' => null, + 'validate_email_addresses' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to_contacts' => true, + 'to_group' => true, + 'to' => true, + 'from' => true, + 'cc' => true, + 'bcc' => true, + 'subject' => true, + 'reply_to' => true, + 'body' => true, + 'html' => true, + 'is_html' => true, + 'charset' => true, + 'attachments' => true, + 'template_variables' => true, + 'template' => true, + 'send_strategy' => true, + 'use_inbox_name' => true, + 'add_tracking_pixel' => true, + 'filter_bounced_recipients' => true, + 'validate_email_addresses' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_contacts' => 'toContacts', + 'to_group' => 'toGroup', + 'to' => 'to', + 'from' => 'from', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'subject' => 'subject', + 'reply_to' => 'replyTo', + 'body' => 'body', + 'html' => 'html', + 'is_html' => 'isHTML', + 'charset' => 'charset', + 'attachments' => 'attachments', + 'template_variables' => 'templateVariables', + 'template' => 'template', + 'send_strategy' => 'sendStrategy', + 'use_inbox_name' => 'useInboxName', + 'add_tracking_pixel' => 'addTrackingPixel', + 'filter_bounced_recipients' => 'filterBouncedRecipients', + 'validate_email_addresses' => 'validateEmailAddresses' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_contacts' => 'setToContacts', + 'to_group' => 'setToGroup', + 'to' => 'setTo', + 'from' => 'setFrom', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'subject' => 'setSubject', + 'reply_to' => 'setReplyTo', + 'body' => 'setBody', + 'html' => 'setHtml', + 'is_html' => 'setIsHtml', + 'charset' => 'setCharset', + 'attachments' => 'setAttachments', + 'template_variables' => 'setTemplateVariables', + 'template' => 'setTemplate', + 'send_strategy' => 'setSendStrategy', + 'use_inbox_name' => 'setUseInboxName', + 'add_tracking_pixel' => 'setAddTrackingPixel', + 'filter_bounced_recipients' => 'setFilterBouncedRecipients', + 'validate_email_addresses' => 'setValidateEmailAddresses' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_contacts' => 'getToContacts', + 'to_group' => 'getToGroup', + 'to' => 'getTo', + 'from' => 'getFrom', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'subject' => 'getSubject', + 'reply_to' => 'getReplyTo', + 'body' => 'getBody', + 'html' => 'getHtml', + 'is_html' => 'getIsHtml', + 'charset' => 'getCharset', + 'attachments' => 'getAttachments', + 'template_variables' => 'getTemplateVariables', + 'template' => 'getTemplate', + 'send_strategy' => 'getSendStrategy', + 'use_inbox_name' => 'getUseInboxName', + 'add_tracking_pixel' => 'getAddTrackingPixel', + 'filter_bounced_recipients' => 'getFilterBouncedRecipients', + 'validate_email_addresses' => 'getValidateEmailAddresses' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE'; + public const VALIDATE_EMAIL_ADDRESSES_VALIDATE_FILTER_REMOVE_INVALID = 'VALIDATE_FILTER_REMOVE_INVALID'; + public const VALIDATE_EMAIL_ADDRESSES_VALIDATE_ERROR_IF_INVALID = 'VALIDATE_ERROR_IF_INVALID'; + public const VALIDATE_EMAIL_ADDRESSES_NO_VALIDATION = 'NO_VALIDATION'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSendStrategyAllowableValues() + { + return [ + self::SEND_STRATEGY_SINGLE_MESSAGE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidateEmailAddressesAllowableValues() + { + return [ + self::VALIDATE_EMAIL_ADDRESSES_VALIDATE_FILTER_REMOVE_INVALID, + self::VALIDATE_EMAIL_ADDRESSES_VALIDATE_ERROR_IF_INVALID, + self::VALIDATE_EMAIL_ADDRESSES_NO_VALIDATION, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('to_contacts', $data ?? [], null); + $this->setIfExists('to_group', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + $this->setIfExists('is_html', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('template_variables', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('send_strategy', $data ?? [], null); + $this->setIfExists('use_inbox_name', $data ?? [], null); + $this->setIfExists('add_tracking_pixel', $data ?? [], null); + $this->setIfExists('filter_bounced_recipients', $data ?? [], null); + $this->setIfExists('validate_email_addresses', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'send_strategy', must be one of '%s'", + $this->container['send_strategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getValidateEmailAddressesAllowableValues(); + if (!is_null($this->container['validate_email_addresses']) && !in_array($this->container['validate_email_addresses'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'validate_email_addresses', must be one of '%s'", + $this->container['validate_email_addresses'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_contacts + * + * @return string[]|null + */ + public function getToContacts() + { + return $this->container['to_contacts']; + } + + /** + * Sets to_contacts + * + * @param string[]|null $to_contacts Optional list of contact IDs to send email to. Manage your contacts via the API or dashboard. When contacts are used the email is sent to each contact separately so they will not see other recipients. + * + * @return self + */ + public function setToContacts($to_contacts) + { + + if (is_null($to_contacts)) { + array_push($this->openAPINullablesSetToNull, 'to_contacts'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to_contacts', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to_contacts'] = $to_contacts; + + return $this; + } + + /** + * Gets to_group + * + * @return string|null + */ + public function getToGroup() + { + return $this->container['to_group']; + } + + /** + * Sets to_group + * + * @param string|null $to_group Optional contact group ID to send email to. You can create contacts and contact groups in the API or dashboard and use them for email campaigns. When contact groups are used the email is sent to each contact separately so they will not see other recipients + * + * @return self + */ + public function setToGroup($to_group) + { + + if (is_null($to_group)) { + array_push($this->openAPINullablesSetToNull, 'to_group'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to_group', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to_group'] = $to_group; + + return $this; + } + + /** + * Gets to + * + * @return string[]|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[]|null $to List of destination email addresses. Each email address must be RFC 5322 format. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating). Be cautious when sending emails that your recipients exist. High bounce rates (meaning a high percentage of emails cannot be delivered because an address does not exist) can result in account freezing. + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets (`my@address.com` or `My inbox `). If no sender is set the source inbox address will be used for this field. If you set `useInboxName` to `true` the from field will include the inbox name as a display name: `inbox_name `. For this to work use the name field when creating an inbox. Beware of potential spam penalties when setting the from field to an address not used by the inbox. Your emails may get blocked by services if you impersonate another address. To use a custom email addresses use a custom domain. You can create domains with the DomainController. The domain must be verified in the dashboard before it can be used. + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc Optional list of cc destination email addresses + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc Optional list of bcc destination email addresses + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Optional email subject line + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo() + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to Optional replyTo header + * + * @return self + */ + public function setReplyTo($reply_to) + { + + if (is_null($reply_to)) { + array_push($this->openAPINullablesSetToNull, 'reply_to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reply_to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body Optional contents of email. If body contains HTML then set `isHTML` to true to ensure that email clients render it correctly. You can use moustache template syntax in the email body in conjunction with `toGroup` contact variables or `templateVariables` data. If you need more templating control consider creating a template and using the `template` property instead of the body. + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets html + * + * @return bool|null + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param bool|null $html Optional HTML flag to indicate that contents is HTML. Set's a `content-type: text/html` for email. (Deprecated: use `isHTML` instead.) + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + array_push($this->openAPINullablesSetToNull, 'html'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('html', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['html'] = $html; + + return $this; + } + + /** + * Gets is_html + * + * @return bool|null + */ + public function getIsHtml() + { + return $this->container['is_html']; + } + + /** + * Sets is_html + * + * @param bool|null $is_html Optional HTML flag. If true the `content-type` of the email will be `text/html`. Set to true when sending HTML to ensure proper rending on email clients + * + * @return self + */ + public function setIsHtml($is_html) + { + + if (is_null($is_html)) { + array_push($this->openAPINullablesSetToNull, 'is_html'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_html', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['is_html'] = $is_html; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset Optional charset + * + * @return self + */ + public function setCharset($charset) + { + + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments Optional list of attachment IDs to send with this email. You must first upload each attachment separately via method call or dashboard in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded. There are several ways to upload that support `multi-part form`, `base64 file encoding`, and octet stream binary uploads. See the `UploadController` for available methods. + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets template_variables + * + * @return array|null + */ + public function getTemplateVariables() + { + return $this->container['template_variables']; + } + + /** + * Sets template_variables + * + * @param array|null $template_variables Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found. + * + * @return self + */ + public function setTemplateVariables($template_variables) + { + + if (is_null($template_variables)) { + array_push($this->openAPINullablesSetToNull, 'template_variables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_variables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template_variables'] = $template_variables; + + return $this; + } + + /** + * Gets template + * + * @return string|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param string|null $template Optional template ID to use for body. Will override body if provided. When using a template make sure you pass the corresponding map of `templateVariables`. You can find which variables are needed by fetching the template itself or viewing it in the dashboard. + * + * @return self + */ + public function setTemplate($template) + { + + if (is_null($template)) { + array_push($this->openAPINullablesSetToNull, 'template'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets send_strategy + * + * @return string|null + */ + public function getSendStrategy() + { + return $this->container['send_strategy']; + } + + /** + * Sets send_strategy + * + * @param string|null $send_strategy How an email should be sent based on its recipients + * + * @return self + */ + public function setSendStrategy($send_strategy) + { + $allowedValues = $this->getSendStrategyAllowableValues(); + if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'send_strategy', must be one of '%s'", + $send_strategy, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($send_strategy)) { + array_push($this->openAPINullablesSetToNull, 'send_strategy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('send_strategy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['send_strategy'] = $send_strategy; + + return $this; + } + + /** + * Gets use_inbox_name + * + * @return bool|null + */ + public function getUseInboxName() + { + return $this->container['use_inbox_name']; + } + + /** + * Sets use_inbox_name + * + * @param bool|null $use_inbox_name Use name of inbox as sender email address name. Will construct RFC 5322 email address with `Inbox name ` if the inbox has a name. + * + * @return self + */ + public function setUseInboxName($use_inbox_name) + { + + if (is_null($use_inbox_name)) { + array_push($this->openAPINullablesSetToNull, 'use_inbox_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('use_inbox_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['use_inbox_name'] = $use_inbox_name; + + return $this; + } + + /** + * Gets add_tracking_pixel + * + * @return bool|null + */ + public function getAddTrackingPixel() + { + return $this->container['add_tracking_pixel']; + } + + /** + * Sets add_tracking_pixel + * + * @param bool|null $add_tracking_pixel Add tracking pixel to email + * + * @return self + */ + public function setAddTrackingPixel($add_tracking_pixel) + { + + if (is_null($add_tracking_pixel)) { + array_push($this->openAPINullablesSetToNull, 'add_tracking_pixel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('add_tracking_pixel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['add_tracking_pixel'] = $add_tracking_pixel; + + return $this; + } + + /** + * Gets filter_bounced_recipients + * + * @return bool|null + */ + public function getFilterBouncedRecipients() + { + return $this->container['filter_bounced_recipients']; + } + + /** + * Sets filter_bounced_recipients + * + * @param bool|null $filter_bounced_recipients Filter recipients to remove any bounced recipients from to, bcc, and cc before sending + * + * @return self + */ + public function setFilterBouncedRecipients($filter_bounced_recipients) + { + + if (is_null($filter_bounced_recipients)) { + array_push($this->openAPINullablesSetToNull, 'filter_bounced_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter_bounced_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['filter_bounced_recipients'] = $filter_bounced_recipients; + + return $this; + } + + /** + * Gets validate_email_addresses + * + * @return string|null + */ + public function getValidateEmailAddresses() + { + return $this->container['validate_email_addresses']; + } + + /** + * Sets validate_email_addresses + * + * @param string|null $validate_email_addresses Validate recipient email addresses before sending + * + * @return self + */ + public function setValidateEmailAddresses($validate_email_addresses) + { + $allowedValues = $this->getValidateEmailAddressesAllowableValues(); + if (!is_null($validate_email_addresses) && !in_array($validate_email_addresses, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'validate_email_addresses', must be one of '%s'", + $validate_email_addresses, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($validate_email_addresses)) { + array_push($this->openAPINullablesSetToNull, 'validate_email_addresses'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validate_email_addresses', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['validate_email_addresses'] = $validate_email_addresses; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SendSMTPEnvelopeOptions.php b/lib/Models/SendSMTPEnvelopeOptions.php new file mode 100644 index 00000000..1c9c1b2e --- /dev/null +++ b/lib/Models/SendSMTPEnvelopeOptions.php @@ -0,0 +1,494 @@ + + */ +class SendSMTPEnvelopeOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SendSMTPEnvelopeOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rcpt_to' => 'string[]', + 'mail_from' => 'string', + 'data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rcpt_to' => null, + 'mail_from' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rcpt_to' => false, + 'mail_from' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rcpt_to' => 'rcptTo', + 'mail_from' => 'mailFrom', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rcpt_to' => 'setRcptTo', + 'mail_from' => 'setMailFrom', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rcpt_to' => 'getRcptTo', + 'mail_from' => 'getMailFrom', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('rcpt_to', $data ?? [], null); + $this->setIfExists('mail_from', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rcpt_to'] === null) { + $invalidProperties[] = "'rcpt_to' can't be null"; + } + if ($this->container['mail_from'] === null) { + $invalidProperties[] = "'mail_from' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets rcpt_to + * + * @return string[] + */ + public function getRcptTo() + { + return $this->container['rcpt_to']; + } + + /** + * Sets rcpt_to + * + * @param string[] $rcpt_to rcpt_to + * + * @return self + */ + public function setRcptTo($rcpt_to) + { + + if (is_null($rcpt_to)) { + throw new \InvalidArgumentException('non-nullable rcpt_to cannot be null'); + } + + $this->container['rcpt_to'] = $rcpt_to; + + return $this; + } + + /** + * Gets mail_from + * + * @return string + */ + public function getMailFrom() + { + return $this->container['mail_from']; + } + + /** + * Sets mail_from + * + * @param string $mail_from mail_from + * + * @return self + */ + public function setMailFrom($mail_from) + { + + if (is_null($mail_from)) { + throw new \InvalidArgumentException('non-nullable mail_from cannot be null'); + } + + $this->container['mail_from'] = $mail_from; + + return $this; + } + + /** + * Gets data + * + * @return string + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string $data data + * + * @return self + */ + public function setData($data) + { + + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SendWithQueueResult.php b/lib/Models/SendWithQueueResult.php new file mode 100644 index 00000000..82032953 --- /dev/null +++ b/lib/Models/SendWithQueueResult.php @@ -0,0 +1,755 @@ + + */ +class SendWithQueueResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SendWithQueueResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'subject' => 'string', + 'inbox_id' => 'string', + 'header_id' => 'string', + 'delivered' => 'bool', + 'exception_name' => 'string', + 'message' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'subject' => null, + 'inbox_id' => 'uuid', + 'header_id' => null, + 'delivered' => null, + 'exception_name' => null, + 'message' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'subject' => false, + 'inbox_id' => false, + 'header_id' => false, + 'delivered' => false, + 'exception_name' => false, + 'message' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'subject' => 'subject', + 'inbox_id' => 'inboxId', + 'header_id' => 'headerId', + 'delivered' => 'delivered', + 'exception_name' => 'exceptionName', + 'message' => 'message', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'subject' => 'setSubject', + 'inbox_id' => 'setInboxId', + 'header_id' => 'setHeaderId', + 'delivered' => 'setDelivered', + 'exception_name' => 'setExceptionName', + 'message' => 'setMessage', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'subject' => 'getSubject', + 'inbox_id' => 'getInboxId', + 'header_id' => 'getHeaderId', + 'delivered' => 'getDelivered', + 'exception_name' => 'getExceptionName', + 'message' => 'getMessage', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('header_id', $data ?? [], null); + $this->setIfExists('delivered', $data ?? [], null); + $this->setIfExists('exception_name', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['header_id'] === null) { + $invalidProperties[] = "'header_id' can't be null"; + } + if ($this->container['delivered'] === null) { + $invalidProperties[] = "'delivered' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets header_id + * + * @return string + */ + public function getHeaderId() + { + return $this->container['header_id']; + } + + /** + * Sets header_id + * + * @param string $header_id header_id + * + * @return self + */ + public function setHeaderId($header_id) + { + + if (is_null($header_id)) { + throw new \InvalidArgumentException('non-nullable header_id cannot be null'); + } + + $this->container['header_id'] = $header_id; + + return $this; + } + + /** + * Gets delivered + * + * @return bool + */ + public function getDelivered() + { + return $this->container['delivered']; + } + + /** + * Sets delivered + * + * @param bool $delivered delivered + * + * @return self + */ + public function setDelivered($delivered) + { + + if (is_null($delivered)) { + throw new \InvalidArgumentException('non-nullable delivered cannot be null'); + } + + $this->container['delivered'] = $delivered; + + return $this; + } + + /** + * Gets exception_name + * + * @return string|null + */ + public function getExceptionName() + { + return $this->container['exception_name']; + } + + /** + * Sets exception_name + * + * @param string|null $exception_name exception_name + * + * @return self + */ + public function setExceptionName($exception_name) + { + + if (is_null($exception_name)) { + throw new \InvalidArgumentException('non-nullable exception_name cannot be null'); + } + + $this->container['exception_name'] = $exception_name; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/Sender.php b/lib/Models/Sender.php new file mode 100644 index 00000000..2aeae5bf --- /dev/null +++ b/lib/Models/Sender.php @@ -0,0 +1,491 @@ + + */ +class Sender implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Sender'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'raw_value' => 'string', + 'email_address' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'raw_value' => null, + 'email_address' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'raw_value' => false, + 'email_address' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'raw_value' => 'rawValue', + 'email_address' => 'emailAddress', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'raw_value' => 'setRawValue', + 'email_address' => 'setEmailAddress', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'raw_value' => 'getRawValue', + 'email_address' => 'getEmailAddress', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('raw_value', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['raw_value'] === null) { + $invalidProperties[] = "'raw_value' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets raw_value + * + * @return string + */ + public function getRawValue() + { + return $this->container['raw_value']; + } + + /** + * Sets raw_value + * + * @param string $raw_value raw_value + * + * @return self + */ + public function setRawValue($raw_value) + { + + if (is_null($raw_value)) { + throw new \InvalidArgumentException('non-nullable raw_value cannot be null'); + } + + $this->container['raw_value'] = $raw_value; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SentEmailDto.php b/lib/Models/SentEmailDto.php new file mode 100644 index 00000000..9aeebfc8 --- /dev/null +++ b/lib/Models/SentEmailDto.php @@ -0,0 +1,1429 @@ + + */ +class SentEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SentEmailDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'domain_id' => 'string', + 'to' => 'string[]', + 'from' => 'string', + 'reply_to' => 'string', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'attachments' => 'string[]', + 'subject' => 'string', + 'body_md5_hash' => 'string', + 'body' => 'string', + 'to_contacts' => 'string[]', + 'to_group' => 'string', + 'charset' => 'string', + 'is_html' => 'bool', + 'sent_at' => '\DateTime', + 'pixel_ids' => 'string[]', + 'message_id' => 'string', + 'message_ids' => 'string[]', + 'virtual_send' => 'bool', + 'template_id' => 'string', + 'template_variables' => 'array', + 'html' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'domain_id' => 'uuid', + 'to' => null, + 'from' => null, + 'reply_to' => null, + 'cc' => null, + 'bcc' => null, + 'attachments' => null, + 'subject' => null, + 'body_md5_hash' => null, + 'body' => null, + 'to_contacts' => 'uuid', + 'to_group' => 'uuid', + 'charset' => null, + 'is_html' => null, + 'sent_at' => 'date-time', + 'pixel_ids' => 'uuid', + 'message_id' => null, + 'message_ids' => null, + 'virtual_send' => null, + 'template_id' => 'uuid', + 'template_variables' => null, + 'html' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'inbox_id' => false, + 'domain_id' => true, + 'to' => true, + 'from' => true, + 'reply_to' => true, + 'cc' => true, + 'bcc' => true, + 'attachments' => true, + 'subject' => true, + 'body_md5_hash' => true, + 'body' => true, + 'to_contacts' => true, + 'to_group' => true, + 'charset' => true, + 'is_html' => true, + 'sent_at' => false, + 'pixel_ids' => true, + 'message_id' => true, + 'message_ids' => true, + 'virtual_send' => true, + 'template_id' => true, + 'template_variables' => true, + 'html' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'domain_id' => 'domainId', + 'to' => 'to', + 'from' => 'from', + 'reply_to' => 'replyTo', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'attachments' => 'attachments', + 'subject' => 'subject', + 'body_md5_hash' => 'bodyMD5Hash', + 'body' => 'body', + 'to_contacts' => 'toContacts', + 'to_group' => 'toGroup', + 'charset' => 'charset', + 'is_html' => 'isHTML', + 'sent_at' => 'sentAt', + 'pixel_ids' => 'pixelIds', + 'message_id' => 'messageId', + 'message_ids' => 'messageIds', + 'virtual_send' => 'virtualSend', + 'template_id' => 'templateId', + 'template_variables' => 'templateVariables', + 'html' => 'html' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'domain_id' => 'setDomainId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'reply_to' => 'setReplyTo', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'attachments' => 'setAttachments', + 'subject' => 'setSubject', + 'body_md5_hash' => 'setBodyMd5Hash', + 'body' => 'setBody', + 'to_contacts' => 'setToContacts', + 'to_group' => 'setToGroup', + 'charset' => 'setCharset', + 'is_html' => 'setIsHtml', + 'sent_at' => 'setSentAt', + 'pixel_ids' => 'setPixelIds', + 'message_id' => 'setMessageId', + 'message_ids' => 'setMessageIds', + 'virtual_send' => 'setVirtualSend', + 'template_id' => 'setTemplateId', + 'template_variables' => 'setTemplateVariables', + 'html' => 'setHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'domain_id' => 'getDomainId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'reply_to' => 'getReplyTo', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'attachments' => 'getAttachments', + 'subject' => 'getSubject', + 'body_md5_hash' => 'getBodyMd5Hash', + 'body' => 'getBody', + 'to_contacts' => 'getToContacts', + 'to_group' => 'getToGroup', + 'charset' => 'getCharset', + 'is_html' => 'getIsHtml', + 'sent_at' => 'getSentAt', + 'pixel_ids' => 'getPixelIds', + 'message_id' => 'getMessageId', + 'message_ids' => 'getMessageIds', + 'virtual_send' => 'getVirtualSend', + 'template_id' => 'getTemplateId', + 'template_variables' => 'getTemplateVariables', + 'html' => 'getHtml' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('body_md5_hash', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('to_contacts', $data ?? [], null); + $this->setIfExists('to_group', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('is_html', $data ?? [], null); + $this->setIfExists('sent_at', $data ?? [], null); + $this->setIfExists('pixel_ids', $data ?? [], null); + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('message_ids', $data ?? [], null); + $this->setIfExists('virtual_send', $data ?? [], null); + $this->setIfExists('template_id', $data ?? [], null); + $this->setIfExists('template_variables', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['sent_at'] === null) { + $invalidProperties[] = "'sent_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of sent email + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id User ID + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Inbox ID email was sent from + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id Domain ID + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets to + * + * @return string[]|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[]|null $to Recipients email was sent to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from Sent from address + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo() + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to reply_to + * + * @return self + */ + public function setReplyTo($reply_to) + { + + if (is_null($reply_to)) { + array_push($this->openAPINullablesSetToNull, 'reply_to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reply_to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc cc + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + array_push($this->openAPINullablesSetToNull, 'cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc bcc + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + array_push($this->openAPINullablesSetToNull, 'bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets attachments + * + * @return string[]|null + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[]|null $attachments Array of IDs of attachments that were sent with this email + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets body_md5_hash + * + * @return string|null + */ + public function getBodyMd5Hash() + { + return $this->container['body_md5_hash']; + } + + /** + * Sets body_md5_hash + * + * @param string|null $body_md5_hash MD5 Hash + * + * @return self + */ + public function setBodyMd5Hash($body_md5_hash) + { + + if (is_null($body_md5_hash)) { + array_push($this->openAPINullablesSetToNull, 'body_md5_hash'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body_md5_hash', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body_md5_hash'] = $body_md5_hash; + + return $this; + } + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body Sent email body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets to_contacts + * + * @return string[]|null + */ + public function getToContacts() + { + return $this->container['to_contacts']; + } + + /** + * Sets to_contacts + * + * @param string[]|null $to_contacts to_contacts + * + * @return self + */ + public function setToContacts($to_contacts) + { + + if (is_null($to_contacts)) { + array_push($this->openAPINullablesSetToNull, 'to_contacts'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to_contacts', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to_contacts'] = $to_contacts; + + return $this; + } + + /** + * Gets to_group + * + * @return string|null + */ + public function getToGroup() + { + return $this->container['to_group']; + } + + /** + * Sets to_group + * + * @param string|null $to_group to_group + * + * @return self + */ + public function setToGroup($to_group) + { + + if (is_null($to_group)) { + array_push($this->openAPINullablesSetToNull, 'to_group'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to_group', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['to_group'] = $to_group; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset charset + * + * @return self + */ + public function setCharset($charset) + { + + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets is_html + * + * @return bool|null + */ + public function getIsHtml() + { + return $this->container['is_html']; + } + + /** + * Sets is_html + * + * @param bool|null $is_html is_html + * + * @return self + */ + public function setIsHtml($is_html) + { + + if (is_null($is_html)) { + array_push($this->openAPINullablesSetToNull, 'is_html'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_html', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['is_html'] = $is_html; + + return $this; + } + + /** + * Gets sent_at + * + * @return \DateTime + */ + public function getSentAt() + { + return $this->container['sent_at']; + } + + /** + * Sets sent_at + * + * @param \DateTime $sent_at sent_at + * + * @return self + */ + public function setSentAt($sent_at) + { + + if (is_null($sent_at)) { + throw new \InvalidArgumentException('non-nullable sent_at cannot be null'); + } + + $this->container['sent_at'] = $sent_at; + + return $this; + } + + /** + * Gets pixel_ids + * + * @return string[]|null + */ + public function getPixelIds() + { + return $this->container['pixel_ids']; + } + + /** + * Sets pixel_ids + * + * @param string[]|null $pixel_ids pixel_ids + * + * @return self + */ + public function setPixelIds($pixel_ids) + { + + if (is_null($pixel_ids)) { + array_push($this->openAPINullablesSetToNull, 'pixel_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pixel_ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['pixel_ids'] = $pixel_ids; + + return $this; + } + + /** + * Gets message_id + * + * @return string|null + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string|null $message_id message_id + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + array_push($this->openAPINullablesSetToNull, 'message_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets message_ids + * + * @return string[]|null + */ + public function getMessageIds() + { + return $this->container['message_ids']; + } + + /** + * Sets message_ids + * + * @param string[]|null $message_ids message_ids + * + * @return self + */ + public function setMessageIds($message_ids) + { + + if (is_null($message_ids)) { + array_push($this->openAPINullablesSetToNull, 'message_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message_ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message_ids'] = $message_ids; + + return $this; + } + + /** + * Gets virtual_send + * + * @return bool|null + */ + public function getVirtualSend() + { + return $this->container['virtual_send']; + } + + /** + * Sets virtual_send + * + * @param bool|null $virtual_send virtual_send + * + * @return self + */ + public function setVirtualSend($virtual_send) + { + + if (is_null($virtual_send)) { + array_push($this->openAPINullablesSetToNull, 'virtual_send'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virtual_send', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['virtual_send'] = $virtual_send; + + return $this; + } + + /** + * Gets template_id + * + * @return string|null + */ + public function getTemplateId() + { + return $this->container['template_id']; + } + + /** + * Sets template_id + * + * @param string|null $template_id template_id + * + * @return self + */ + public function setTemplateId($template_id) + { + + if (is_null($template_id)) { + array_push($this->openAPINullablesSetToNull, 'template_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template_id'] = $template_id; + + return $this; + } + + /** + * Gets template_variables + * + * @return array|null + */ + public function getTemplateVariables() + { + return $this->container['template_variables']; + } + + /** + * Sets template_variables + * + * @param array|null $template_variables template_variables + * + * @return self + */ + public function setTemplateVariables($template_variables) + { + + if (is_null($template_variables)) { + array_push($this->openAPINullablesSetToNull, 'template_variables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_variables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['template_variables'] = $template_variables; + + return $this; + } + + /** + * Gets html + * + * @return bool|null + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param bool|null $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SentEmailProjection.php b/lib/Models/SentEmailProjection.php new file mode 100644 index 00000000..224d3f03 --- /dev/null +++ b/lib/Models/SentEmailProjection.php @@ -0,0 +1,836 @@ + + */ +class SentEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SentEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'from' => 'string', + 'user_id' => 'string', + 'subject' => 'string', + 'inbox_id' => 'string', + 'attachments' => 'string[]', + 'created_at' => '\DateTime', + 'to' => 'string[]', + 'bcc' => 'string[]', + 'cc' => 'string[]', + 'body_md5_hash' => 'string', + 'virtual_send' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'from' => null, + 'user_id' => 'uuid', + 'subject' => null, + 'inbox_id' => 'uuid', + 'attachments' => null, + 'created_at' => 'date-time', + 'to' => null, + 'bcc' => null, + 'cc' => null, + 'body_md5_hash' => null, + 'virtual_send' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from' => false, + 'user_id' => false, + 'subject' => false, + 'inbox_id' => false, + 'attachments' => false, + 'created_at' => false, + 'to' => false, + 'bcc' => false, + 'cc' => false, + 'body_md5_hash' => false, + 'virtual_send' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'from' => 'from', + 'user_id' => 'userId', + 'subject' => 'subject', + 'inbox_id' => 'inboxId', + 'attachments' => 'attachments', + 'created_at' => 'createdAt', + 'to' => 'to', + 'bcc' => 'bcc', + 'cc' => 'cc', + 'body_md5_hash' => 'bodyMD5Hash', + 'virtual_send' => 'virtualSend' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'from' => 'setFrom', + 'user_id' => 'setUserId', + 'subject' => 'setSubject', + 'inbox_id' => 'setInboxId', + 'attachments' => 'setAttachments', + 'created_at' => 'setCreatedAt', + 'to' => 'setTo', + 'bcc' => 'setBcc', + 'cc' => 'setCc', + 'body_md5_hash' => 'setBodyMd5Hash', + 'virtual_send' => 'setVirtualSend' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'from' => 'getFrom', + 'user_id' => 'getUserId', + 'subject' => 'getSubject', + 'inbox_id' => 'getInboxId', + 'attachments' => 'getAttachments', + 'created_at' => 'getCreatedAt', + 'to' => 'getTo', + 'bcc' => 'getBcc', + 'cc' => 'getCc', + 'body_md5_hash' => 'getBodyMd5Hash', + 'virtual_send' => 'getVirtualSend' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('body_md5_hash', $data ?? [], null); + $this->setIfExists('virtual_send', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['attachments'] === null) { + $invalidProperties[] = "'attachments' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['bcc'] === null) { + $invalidProperties[] = "'bcc' can't be null"; + } + if ($this->container['cc'] === null) { + $invalidProperties[] = "'cc' can't be null"; + } + if ($this->container['virtual_send'] === null) { + $invalidProperties[] = "'virtual_send' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from from + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets attachments + * + * @return string[] + */ + public function getAttachments() + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param string[] $attachments attachments + * + * @return self + */ + public function setAttachments($attachments) + { + + if (is_null($attachments)) { + throw new \InvalidArgumentException('non-nullable attachments cannot be null'); + } + + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets bcc + * + * @return string[] + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[] $bcc bcc + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets cc + * + * @return string[] + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[] $cc cc + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets body_md5_hash + * + * @return string|null + */ + public function getBodyMd5Hash() + { + return $this->container['body_md5_hash']; + } + + /** + * Sets body_md5_hash + * + * @param string|null $body_md5_hash body_md5_hash + * + * @return self + */ + public function setBodyMd5Hash($body_md5_hash) + { + + if (is_null($body_md5_hash)) { + throw new \InvalidArgumentException('non-nullable body_md5_hash cannot be null'); + } + + $this->container['body_md5_hash'] = $body_md5_hash; + + return $this; + } + + /** + * Gets virtual_send + * + * @return bool + */ + public function getVirtualSend() + { + return $this->container['virtual_send']; + } + + /** + * Sets virtual_send + * + * @param bool $virtual_send virtual_send + * + * @return self + */ + public function setVirtualSend($virtual_send) + { + + if (is_null($virtual_send)) { + throw new \InvalidArgumentException('non-nullable virtual_send cannot be null'); + } + + $this->container['virtual_send'] = $virtual_send; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SetInboxFavouritedOptions.php b/lib/Models/SetInboxFavouritedOptions.php new file mode 100644 index 00000000..0c67cbcf --- /dev/null +++ b/lib/Models/SetInboxFavouritedOptions.php @@ -0,0 +1,416 @@ + + */ +class SetInboxFavouritedOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SetInboxFavouritedOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'state' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'state' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'state' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'state' => 'state' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'state' => 'setState' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'state' => 'getState' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('state', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets state + * + * @return bool + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param bool $state Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setState($state) + { + + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + + $this->container['state'] = $state; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SimpleSendEmailOptions.php b/lib/Models/SimpleSendEmailOptions.php new file mode 100644 index 00000000..eb71a714 --- /dev/null +++ b/lib/Models/SimpleSendEmailOptions.php @@ -0,0 +1,545 @@ + + */ +class SimpleSendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleSendEmailOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender_id' => 'string', + 'to' => 'string', + 'body' => 'string', + 'subject' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender_id' => 'uuid', + 'to' => null, + 'body' => null, + 'subject' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender_id' => true, + 'to' => false, + 'body' => true, + 'subject' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender_id' => 'senderId', + 'to' => 'to', + 'body' => 'body', + 'subject' => 'subject' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender_id' => 'setSenderId', + 'to' => 'setTo', + 'body' => 'setBody', + 'subject' => 'setSubject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender_id' => 'getSenderId', + 'to' => 'getTo', + 'body' => 'getBody', + 'subject' => 'getSubject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender_id + * + * @return string|null + */ + public function getSenderId() + { + return $this->container['sender_id']; + } + + /** + * Sets sender_id + * + * @param string|null $sender_id ID of inbox to send from. If null an inbox will be created for sending + * + * @return self + */ + public function setSenderId($sender_id) + { + + if (is_null($sender_id)) { + array_push($this->openAPINullablesSetToNull, 'sender_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sender_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sender_id'] = $sender_id; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Email address to send to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body Body of the email message. Supports HTML + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Subject line of the email + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SmsDto.php b/lib/Models/SmsDto.php new file mode 100644 index 00000000..46fdc3d1 --- /dev/null +++ b/lib/Models/SmsDto.php @@ -0,0 +1,688 @@ + + */ +class SmsDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SmsDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'phone_number' => 'string', + 'from_number' => 'string', + 'body' => 'string', + 'read' => 'bool', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'phone_number' => 'uuid', + 'from_number' => null, + 'body' => null, + 'read' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'phone_number' => false, + 'from_number' => false, + 'body' => false, + 'read' => false, + 'created_at' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'phone_number' => 'phoneNumber', + 'from_number' => 'fromNumber', + 'body' => 'body', + 'read' => 'read', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'phone_number' => 'setPhoneNumber', + 'from_number' => 'setFromNumber', + 'body' => 'setBody', + 'read' => 'setRead', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'phone_number' => 'getPhoneNumber', + 'from_number' => 'getFromNumber', + 'body' => 'getBody', + 'read' => 'getRead', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('from_number', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['from_number'] === null) { + $invalidProperties[] = "'from_number' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number phone_number + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets from_number + * + * @return string + */ + public function getFromNumber() + { + return $this->container['from_number']; + } + + /** + * Sets from_number + * + * @param string $from_number from_number + * + * @return self + */ + public function setFromNumber($from_number) + { + + if (is_null($from_number)) { + throw new \InvalidArgumentException('non-nullable from_number cannot be null'); + } + + $this->container['from_number'] = $from_number; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read read + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SmsMatchOption.php b/lib/Models/SmsMatchOption.php new file mode 100644 index 00000000..cd4419cb --- /dev/null +++ b/lib/Models/SmsMatchOption.php @@ -0,0 +1,562 @@ + + */ +class SmsMatchOption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SmsMatchOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'field' => 'string', + 'should' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field' => null, + 'should' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'field' => false, + 'should' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'field' => 'field', + 'should' => 'should', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field' => 'setField', + 'should' => 'setShould', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field' => 'getField', + 'should' => 'getShould', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const FIELD_BODY = 'BODY'; + public const FIELD_FROM = 'FROM'; + public const SHOULD_CONTAIN = 'CONTAIN'; + public const SHOULD_EQUAL = 'EQUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldAllowableValues() + { + return [ + self::FIELD_BODY, + self::FIELD_FROM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getShouldAllowableValues() + { + return [ + self::SHOULD_CONTAIN, + self::SHOULD_EQUAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('should', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['field'] === null) { + $invalidProperties[] = "'field' can't be null"; + } + $allowedValues = $this->getFieldAllowableValues(); + if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field', must be one of '%s'", + $this->container['field'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['should'] === null) { + $invalidProperties[] = "'should' can't be null"; + } + $allowedValues = $this->getShouldAllowableValues(); + if (!is_null($this->container['should']) && !in_array($this->container['should'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'should', must be one of '%s'", + $this->container['should'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets field + * + * @return string + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string $field Fields of an SMS object that can be used to filter results + * + * @return self + */ + public function setField($field) + { + $allowedValues = $this->getFieldAllowableValues(); + if (!in_array($field, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field', must be one of '%s'", + $field, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets should + * + * @return string + */ + public function getShould() + { + return $this->container['should']; + } + + /** + * Sets should + * + * @param string $should How the value of the email field specified should be compared to the value given in the match options. + * + * @return self + */ + public function setShould($should) + { + $allowedValues = $this->getShouldAllowableValues(); + if (!in_array($should, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'should', must be one of '%s'", + $should, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($should)) { + throw new \InvalidArgumentException('non-nullable should cannot be null'); + } + + $this->container['should'] = $should; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed. + * + * @return self + */ + public function setValue($value) + { + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SmsPreview.php b/lib/Models/SmsPreview.php new file mode 100644 index 00000000..ab525cc2 --- /dev/null +++ b/lib/Models/SmsPreview.php @@ -0,0 +1,610 @@ + + */ +class SmsPreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SmsPreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'body' => 'string', + 'phone_number' => 'string', + 'from_number' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'body' => null, + 'phone_number' => 'uuid', + 'from_number' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'body' => false, + 'phone_number' => false, + 'from_number' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'body' => 'body', + 'phone_number' => 'phoneNumber', + 'from_number' => 'fromNumber', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'body' => 'setBody', + 'phone_number' => 'setPhoneNumber', + 'from_number' => 'setFromNumber', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'body' => 'getBody', + 'phone_number' => 'getPhoneNumber', + 'from_number' => 'getFromNumber', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('from_number', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['from_number'] === null) { + $invalidProperties[] = "'from_number' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number phone_number + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets from_number + * + * @return string + */ + public function getFromNumber() + { + return $this->container['from_number']; + } + + /** + * Sets from_number + * + * @param string $from_number from_number + * + * @return self + */ + public function setFromNumber($from_number) + { + + if (is_null($from_number)) { + throw new \InvalidArgumentException('non-nullable from_number cannot be null'); + } + + $this->container['from_number'] = $from_number; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/SmsProjection.php b/lib/Models/SmsProjection.php new file mode 100644 index 00000000..ef7720ee --- /dev/null +++ b/lib/Models/SmsProjection.php @@ -0,0 +1,650 @@ + + */ +class SmsProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SmsProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'body' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'phone_number' => 'string', + 'from_number' => 'string', + 'read' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'body' => null, + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'phone_number' => 'uuid', + 'from_number' => null, + 'read' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'body' => false, + 'user_id' => false, + 'created_at' => false, + 'phone_number' => false, + 'from_number' => false, + 'read' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'body' => 'body', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'phone_number' => 'phoneNumber', + 'from_number' => 'fromNumber', + 'read' => 'read' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'body' => 'setBody', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'phone_number' => 'setPhoneNumber', + 'from_number' => 'setFromNumber', + 'read' => 'setRead' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'body' => 'getBody', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'phone_number' => 'getPhoneNumber', + 'from_number' => 'getFromNumber', + 'read' => 'getRead' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('from_number', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['from_number'] === null) { + $invalidProperties[] = "'from_number' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number phone_number + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets from_number + * + * @return string + */ + public function getFromNumber() + { + return $this->container['from_number']; + } + + /** + * Sets from_number + * + * @param string $from_number from_number + * + * @return self + */ + public function setFromNumber($from_number) + { + + if (is_null($from_number)) { + throw new \InvalidArgumentException('non-nullable from_number cannot be null'); + } + + $this->container['from_number'] = $from_number; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read read + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/Sort.php b/lib/Models/Sort.php new file mode 100644 index 00000000..0241f3c3 --- /dev/null +++ b/lib/Models/Sort.php @@ -0,0 +1,484 @@ + + */ +class Sort implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Sort'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'empty' => 'bool', + 'sorted' => 'bool', + 'unsorted' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'empty' => null, + 'sorted' => null, + 'unsorted' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'empty' => false, + 'sorted' => false, + 'unsorted' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'empty' => 'empty', + 'sorted' => 'sorted', + 'unsorted' => 'unsorted' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'empty' => 'setEmpty', + 'sorted' => 'setSorted', + 'unsorted' => 'setUnsorted' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'empty' => 'getEmpty', + 'sorted' => 'getSorted', + 'unsorted' => 'getUnsorted' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('empty', $data ?? [], null); + $this->setIfExists('sorted', $data ?? [], null); + $this->setIfExists('unsorted', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets empty + * + * @return bool|null + */ + public function getEmpty() + { + return $this->container['empty']; + } + + /** + * Sets empty + * + * @param bool|null $empty empty + * + * @return self + */ + public function setEmpty($empty) + { + + if (is_null($empty)) { + throw new \InvalidArgumentException('non-nullable empty cannot be null'); + } + + $this->container['empty'] = $empty; + + return $this; + } + + /** + * Gets sorted + * + * @return bool|null + */ + public function getSorted() + { + return $this->container['sorted']; + } + + /** + * Sets sorted + * + * @param bool|null $sorted sorted + * + * @return self + */ + public function setSorted($sorted) + { + + if (is_null($sorted)) { + throw new \InvalidArgumentException('non-nullable sorted cannot be null'); + } + + $this->container['sorted'] = $sorted; + + return $this; + } + + /** + * Gets unsorted + * + * @return bool|null + */ + public function getUnsorted() + { + return $this->container['unsorted']; + } + + /** + * Sets unsorted + * + * @param bool|null $unsorted unsorted + * + * @return self + */ + public function setUnsorted($unsorted) + { + + if (is_null($unsorted)) { + throw new \InvalidArgumentException('non-nullable unsorted cannot be null'); + } + + $this->container['unsorted'] = $unsorted; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TemplateDto.php b/lib/Models/TemplateDto.php new file mode 100644 index 00000000..5a7b93f4 --- /dev/null +++ b/lib/Models/TemplateDto.php @@ -0,0 +1,572 @@ + + */ +class TemplateDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TemplateDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'variables' => '\MailSlurp\Models\TemplateVariable[]', + 'content' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'name' => null, + 'variables' => null, + 'content' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'variables' => false, + 'content' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'variables' => 'variables', + 'content' => 'content', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'variables' => 'setVariables', + 'content' => 'setContent', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'variables' => 'getVariables', + 'content' => 'getContent', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('variables', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['variables'] === null) { + $invalidProperties[] = "'variables' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of template + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Template name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets variables + * + * @return \MailSlurp\Models\TemplateVariable[] + */ + public function getVariables() + { + return $this->container['variables']; + } + + /** + * Sets variables + * + * @param \MailSlurp\Models\TemplateVariable[] $variables Variables available in template that can be replaced with values + * + * @return self + */ + public function setVariables($variables) + { + + if (is_null($variables)) { + throw new \InvalidArgumentException('non-nullable variables cannot be null'); + } + + $this->container['variables'] = $variables; + + return $this; + } + + /** + * Gets content + * + * @return string + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string $content Content of the template + * + * @return self + */ + public function setContent($content) + { + + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Created at time + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TemplatePreview.php b/lib/Models/TemplatePreview.php new file mode 100644 index 00000000..9ecca158 --- /dev/null +++ b/lib/Models/TemplatePreview.php @@ -0,0 +1,415 @@ + + */ +class TemplatePreview implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TemplatePreview'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'preview' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'preview' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'preview' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'preview' => 'preview' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'preview' => 'setPreview' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'preview' => 'getPreview' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('preview', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['preview'] === null) { + $invalidProperties[] = "'preview' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets preview + * + * @return string + */ + public function getPreview() + { + return $this->container['preview']; + } + + /** + * Sets preview + * + * @param string $preview preview + * + * @return self + */ + public function setPreview($preview) + { + + if (is_null($preview)) { + throw new \InvalidArgumentException('non-nullable preview cannot be null'); + } + + $this->container['preview'] = $preview; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TemplateProjection.php b/lib/Models/TemplateProjection.php new file mode 100644 index 00000000..d8a846d3 --- /dev/null +++ b/lib/Models/TemplateProjection.php @@ -0,0 +1,572 @@ + + */ +class TemplateProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TemplateProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'variables' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'variables' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'created_at' => false, + 'updated_at' => false, + 'variables' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'variables' => 'variables' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'variables' => 'setVariables' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'variables' => 'getVariables' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('variables', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['variables'] === null) { + $invalidProperties[] = "'variables' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets variables + * + * @return string[] + */ + public function getVariables() + { + return $this->container['variables']; + } + + /** + * Sets variables + * + * @param string[] $variables variables + * + * @return self + */ + public function setVariables($variables) + { + + if (is_null($variables)) { + throw new \InvalidArgumentException('non-nullable variables cannot be null'); + } + + $this->container['variables'] = $variables; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TemplateVariable.php b/lib/Models/TemplateVariable.php new file mode 100644 index 00000000..2ca964ec --- /dev/null +++ b/lib/Models/TemplateVariable.php @@ -0,0 +1,487 @@ + + */ +class TemplateVariable implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TemplateVariable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'variable_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'variable_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'variable_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'variable_type' => 'variableType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'variable_type' => 'setVariableType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'variable_type' => 'getVariableType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const VARIABLE_TYPE_STRING = 'STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVariableTypeAllowableValues() + { + return [ + self::VARIABLE_TYPE_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('variable_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['variable_type'] === null) { + $invalidProperties[] = "'variable_type' can't be null"; + } + $allowedValues = $this->getVariableTypeAllowableValues(); + if (!is_null($this->container['variable_type']) && !in_array($this->container['variable_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'variable_type', must be one of '%s'", + $this->container['variable_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of variable. This can be used in a template as {{name}} + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets variable_type + * + * @return string + */ + public function getVariableType() + { + return $this->container['variable_type']; + } + + /** + * Sets variable_type + * + * @param string $variable_type The type of variable + * + * @return self + */ + public function setVariableType($variable_type) + { + $allowedValues = $this->getVariableTypeAllowableValues(); + if (!in_array($variable_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'variable_type', must be one of '%s'", + $variable_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($variable_type)) { + throw new \InvalidArgumentException('non-nullable variable_type cannot be null'); + } + + $this->container['variable_type'] = $variable_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TestNewInboxForwarderOptions.php b/lib/Models/TestNewInboxForwarderOptions.php new file mode 100644 index 00000000..f3b3d4ac --- /dev/null +++ b/lib/Models/TestNewInboxForwarderOptions.php @@ -0,0 +1,455 @@ + + */ +class TestNewInboxForwarderOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestNewInboxForwarderOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_forwarder_test_options' => '\MailSlurp\Models\InboxForwarderTestOptions', + 'create_inbox_forwarder_options' => '\MailSlurp\Models\CreateInboxForwarderOptions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_forwarder_test_options' => null, + 'create_inbox_forwarder_options' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_forwarder_test_options' => false, + 'create_inbox_forwarder_options' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_forwarder_test_options' => 'inboxForwarderTestOptions', + 'create_inbox_forwarder_options' => 'createInboxForwarderOptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_forwarder_test_options' => 'setInboxForwarderTestOptions', + 'create_inbox_forwarder_options' => 'setCreateInboxForwarderOptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_forwarder_test_options' => 'getInboxForwarderTestOptions', + 'create_inbox_forwarder_options' => 'getCreateInboxForwarderOptions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_forwarder_test_options', $data ?? [], null); + $this->setIfExists('create_inbox_forwarder_options', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_forwarder_test_options'] === null) { + $invalidProperties[] = "'inbox_forwarder_test_options' can't be null"; + } + if ($this->container['create_inbox_forwarder_options'] === null) { + $invalidProperties[] = "'create_inbox_forwarder_options' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_forwarder_test_options + * + * @return \MailSlurp\Models\InboxForwarderTestOptions + */ + public function getInboxForwarderTestOptions() + { + return $this->container['inbox_forwarder_test_options']; + } + + /** + * Sets inbox_forwarder_test_options + * + * @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options + * + * @return self + */ + public function setInboxForwarderTestOptions($inbox_forwarder_test_options) + { + + if (is_null($inbox_forwarder_test_options)) { + throw new \InvalidArgumentException('non-nullable inbox_forwarder_test_options cannot be null'); + } + + $this->container['inbox_forwarder_test_options'] = $inbox_forwarder_test_options; + + return $this; + } + + /** + * Gets create_inbox_forwarder_options + * + * @return \MailSlurp\Models\CreateInboxForwarderOptions + */ + public function getCreateInboxForwarderOptions() + { + return $this->container['create_inbox_forwarder_options']; + } + + /** + * Sets create_inbox_forwarder_options + * + * @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options + * + * @return self + */ + public function setCreateInboxForwarderOptions($create_inbox_forwarder_options) + { + + if (is_null($create_inbox_forwarder_options)) { + throw new \InvalidArgumentException('non-nullable create_inbox_forwarder_options cannot be null'); + } + + $this->container['create_inbox_forwarder_options'] = $create_inbox_forwarder_options; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TestNewInboxRulesetOptions.php b/lib/Models/TestNewInboxRulesetOptions.php new file mode 100644 index 00000000..799d2b27 --- /dev/null +++ b/lib/Models/TestNewInboxRulesetOptions.php @@ -0,0 +1,455 @@ + + */ +class TestNewInboxRulesetOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestNewInboxRulesetOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_ruleset_test_options' => '\MailSlurp\Models\InboxRulesetTestOptions', + 'create_inbox_ruleset_options' => '\MailSlurp\Models\CreateInboxRulesetOptions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_ruleset_test_options' => null, + 'create_inbox_ruleset_options' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_ruleset_test_options' => false, + 'create_inbox_ruleset_options' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_ruleset_test_options' => 'inboxRulesetTestOptions', + 'create_inbox_ruleset_options' => 'createInboxRulesetOptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_ruleset_test_options' => 'setInboxRulesetTestOptions', + 'create_inbox_ruleset_options' => 'setCreateInboxRulesetOptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_ruleset_test_options' => 'getInboxRulesetTestOptions', + 'create_inbox_ruleset_options' => 'getCreateInboxRulesetOptions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_ruleset_test_options', $data ?? [], null); + $this->setIfExists('create_inbox_ruleset_options', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_ruleset_test_options'] === null) { + $invalidProperties[] = "'inbox_ruleset_test_options' can't be null"; + } + if ($this->container['create_inbox_ruleset_options'] === null) { + $invalidProperties[] = "'create_inbox_ruleset_options' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_ruleset_test_options + * + * @return \MailSlurp\Models\InboxRulesetTestOptions + */ + public function getInboxRulesetTestOptions() + { + return $this->container['inbox_ruleset_test_options']; + } + + /** + * Sets inbox_ruleset_test_options + * + * @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options + * + * @return self + */ + public function setInboxRulesetTestOptions($inbox_ruleset_test_options) + { + + if (is_null($inbox_ruleset_test_options)) { + throw new \InvalidArgumentException('non-nullable inbox_ruleset_test_options cannot be null'); + } + + $this->container['inbox_ruleset_test_options'] = $inbox_ruleset_test_options; + + return $this; + } + + /** + * Gets create_inbox_ruleset_options + * + * @return \MailSlurp\Models\CreateInboxRulesetOptions + */ + public function getCreateInboxRulesetOptions() + { + return $this->container['create_inbox_ruleset_options']; + } + + /** + * Sets create_inbox_ruleset_options + * + * @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options + * + * @return self + */ + public function setCreateInboxRulesetOptions($create_inbox_ruleset_options) + { + + if (is_null($create_inbox_ruleset_options)) { + throw new \InvalidArgumentException('non-nullable create_inbox_ruleset_options cannot be null'); + } + + $this->container['create_inbox_ruleset_options'] = $create_inbox_ruleset_options; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TestPhoneNumberOptions.php b/lib/Models/TestPhoneNumberOptions.php new file mode 100644 index 00000000..bfbca982 --- /dev/null +++ b/lib/Models/TestPhoneNumberOptions.php @@ -0,0 +1,415 @@ + + */ +class TestPhoneNumberOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestPhoneNumberOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ThreadProjection.php b/lib/Models/ThreadProjection.php new file mode 100644 index 00000000..4215c150 --- /dev/null +++ b/lib/Models/ThreadProjection.php @@ -0,0 +1,794 @@ + + */ +class ThreadProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ThreadProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'subject' => 'string', + 'inbox_id' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'to' => 'string[]', + 'bcc' => 'string[]', + 'cc' => 'string[]', + 'alias_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'subject' => null, + 'inbox_id' => 'uuid', + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'to' => null, + 'bcc' => null, + 'cc' => null, + 'alias_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'subject' => false, + 'inbox_id' => false, + 'user_id' => false, + 'created_at' => false, + 'updated_at' => false, + 'to' => false, + 'bcc' => false, + 'cc' => false, + 'alias_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'subject' => 'subject', + 'inbox_id' => 'inboxId', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'to' => 'to', + 'bcc' => 'bcc', + 'cc' => 'cc', + 'alias_id' => 'aliasId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'subject' => 'setSubject', + 'inbox_id' => 'setInboxId', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'to' => 'setTo', + 'bcc' => 'setBcc', + 'cc' => 'setCc', + 'alias_id' => 'setAliasId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'subject' => 'getSubject', + 'inbox_id' => 'getInboxId', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'to' => 'getTo', + 'bcc' => 'getBcc', + 'cc' => 'getCc', + 'alias_id' => 'getAliasId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('alias_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['alias_id'] === null) { + $invalidProperties[] = "'alias_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of thread + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of email thread + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Thread subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Inbox ID + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id User ID + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Created at DateTime + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at Updated at DateTime + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to To recipients + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets bcc + * + * @return string[]|null + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[]|null $bcc BCC recipients + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets cc + * + * @return string[]|null + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[]|null $cc CC recipients + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets alias_id + * + * @return string + */ + public function getAliasId() + { + return $this->container['alias_id']; + } + + /** + * Sets alias_id + * + * @param string $alias_id Alias ID + * + * @return self + */ + public function setAliasId($alias_id) + { + + if (is_null($alias_id)) { + throw new \InvalidArgumentException('non-nullable alias_id cannot be null'); + } + + $this->container['alias_id'] = $alias_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TrackingPixelDto.php b/lib/Models/TrackingPixelDto.php new file mode 100644 index 00000000..db5ab39d --- /dev/null +++ b/lib/Models/TrackingPixelDto.php @@ -0,0 +1,744 @@ + + */ +class TrackingPixelDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackingPixelDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'seen' => 'bool', + 'recipient' => 'string', + 'html' => 'string', + 'url' => 'string', + 'inbox_id' => 'string', + 'sent_email_id' => 'string', + 'seen_at' => '\DateTime', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'seen' => null, + 'recipient' => null, + 'html' => null, + 'url' => null, + 'inbox_id' => 'uuid', + 'sent_email_id' => 'uuid', + 'seen_at' => 'date-time', + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'seen' => false, + 'recipient' => true, + 'html' => false, + 'url' => false, + 'inbox_id' => true, + 'sent_email_id' => true, + 'seen_at' => true, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'seen' => 'seen', + 'recipient' => 'recipient', + 'html' => 'html', + 'url' => 'url', + 'inbox_id' => 'inboxId', + 'sent_email_id' => 'sentEmailId', + 'seen_at' => 'seenAt', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'seen' => 'setSeen', + 'recipient' => 'setRecipient', + 'html' => 'setHtml', + 'url' => 'setUrl', + 'inbox_id' => 'setInboxId', + 'sent_email_id' => 'setSentEmailId', + 'seen_at' => 'setSeenAt', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'seen' => 'getSeen', + 'recipient' => 'getRecipient', + 'html' => 'getHtml', + 'url' => 'getUrl', + 'inbox_id' => 'getInboxId', + 'sent_email_id' => 'getSentEmailId', + 'seen_at' => 'getSeenAt', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('seen', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('seen_at', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['seen'] === null) { + $invalidProperties[] = "'seen' can't be null"; + } + if ($this->container['html'] === null) { + $invalidProperties[] = "'html' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets seen + * + * @return bool + */ + public function getSeen() + { + return $this->container['seen']; + } + + /** + * Sets seen + * + * @param bool $seen seen + * + * @return self + */ + public function setSeen($seen) + { + + if (is_null($seen)) { + throw new \InvalidArgumentException('non-nullable seen cannot be null'); + } + + $this->container['seen'] = $seen; + + return $this; + } + + /** + * Gets recipient + * + * @return string|null + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string|null $recipient recipient + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + array_push($this->openAPINullablesSetToNull, 'recipient'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recipient', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['recipient'] = $recipient; + + return $this; + } + + /** + * Gets html + * + * @return string + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param string $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url url + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string|null + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string|null $sent_email_id sent_email_id + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + array_push($this->openAPINullablesSetToNull, 'sent_email_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_email_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets seen_at + * + * @return \DateTime|null + */ + public function getSeenAt() + { + return $this->container['seen_at']; + } + + /** + * Sets seen_at + * + * @param \DateTime|null $seen_at seen_at + * + * @return self + */ + public function setSeenAt($seen_at) + { + + if (is_null($seen_at)) { + array_push($this->openAPINullablesSetToNull, 'seen_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('seen_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['seen_at'] = $seen_at; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/TrackingPixelProjection.php b/lib/Models/TrackingPixelProjection.php new file mode 100644 index 00000000..ba5c6728 --- /dev/null +++ b/lib/Models/TrackingPixelProjection.php @@ -0,0 +1,713 @@ + + */ +class TrackingPixelProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TrackingPixelProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'inbox_id' => 'string', + 'user_id' => 'string', + 'created_at' => '\DateTime', + 'sent_email_id' => 'string', + 'recipient' => 'string', + 'seen' => 'bool', + 'seen_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'inbox_id' => 'uuid', + 'user_id' => 'uuid', + 'created_at' => 'date-time', + 'sent_email_id' => 'uuid', + 'recipient' => null, + 'seen' => null, + 'seen_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'inbox_id' => false, + 'user_id' => false, + 'created_at' => false, + 'sent_email_id' => false, + 'recipient' => false, + 'seen' => false, + 'seen_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'inbox_id' => 'inboxId', + 'user_id' => 'userId', + 'created_at' => 'createdAt', + 'sent_email_id' => 'sentEmailId', + 'recipient' => 'recipient', + 'seen' => 'seen', + 'seen_at' => 'seenAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'inbox_id' => 'setInboxId', + 'user_id' => 'setUserId', + 'created_at' => 'setCreatedAt', + 'sent_email_id' => 'setSentEmailId', + 'recipient' => 'setRecipient', + 'seen' => 'setSeen', + 'seen_at' => 'setSeenAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'inbox_id' => 'getInboxId', + 'user_id' => 'getUserId', + 'created_at' => 'getCreatedAt', + 'sent_email_id' => 'getSentEmailId', + 'recipient' => 'getRecipient', + 'seen' => 'getSeen', + 'seen_at' => 'getSeenAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('seen', $data ?? [], null); + $this->setIfExists('seen_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['seen'] === null) { + $invalidProperties[] = "'seen' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string|null + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string|null $sent_email_id sent_email_id + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + throw new \InvalidArgumentException('non-nullable sent_email_id cannot be null'); + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets recipient + * + * @return string|null + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string|null $recipient recipient + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + throw new \InvalidArgumentException('non-nullable recipient cannot be null'); + } + + $this->container['recipient'] = $recipient; + + return $this; + } + + /** + * Gets seen + * + * @return bool + */ + public function getSeen() + { + return $this->container['seen']; + } + + /** + * Sets seen + * + * @param bool $seen seen + * + * @return self + */ + public function setSeen($seen) + { + + if (is_null($seen)) { + throw new \InvalidArgumentException('non-nullable seen cannot be null'); + } + + $this->container['seen'] = $seen; + + return $this; + } + + /** + * Gets seen_at + * + * @return \DateTime|null + */ + public function getSeenAt() + { + return $this->container['seen_at']; + } + + /** + * Sets seen_at + * + * @param \DateTime|null $seen_at seen_at + * + * @return self + */ + public function setSeenAt($seen_at) + { + + if (is_null($seen_at)) { + throw new \InvalidArgumentException('non-nullable seen_at cannot be null'); + } + + $this->container['seen_at'] = $seen_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UnknownMissedEmailProjection.php b/lib/Models/UnknownMissedEmailProjection.php new file mode 100644 index 00000000..1e97dee0 --- /dev/null +++ b/lib/Models/UnknownMissedEmailProjection.php @@ -0,0 +1,563 @@ + + */ +class UnknownMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UnknownMissedEmailProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'from' => 'string', + 'subject' => 'string', + 'created_at' => '\DateTime', + 'to' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'from' => null, + 'subject' => null, + 'created_at' => 'date-time', + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from' => false, + 'subject' => false, + 'created_at' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'from' => 'from', + 'subject' => 'subject', + 'created_at' => 'createdAt', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'from' => 'setFrom', + 'subject' => 'setSubject', + 'created_at' => 'setCreatedAt', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'from' => 'getFrom', + 'subject' => 'getSubject', + 'created_at' => 'getCreatedAt', + 'to' => 'getTo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from from + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets to + * + * @return string[]|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[]|null $to to + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UnreadCount.php b/lib/Models/UnreadCount.php new file mode 100644 index 00000000..c6b184f0 --- /dev/null +++ b/lib/Models/UnreadCount.php @@ -0,0 +1,416 @@ + + */ +class UnreadCount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UnreadCount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count count + * + * @return self + */ + public function setCount($count) + { + + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UnseenErrorCountDto.php b/lib/Models/UnseenErrorCountDto.php new file mode 100644 index 00000000..862018ad --- /dev/null +++ b/lib/Models/UnseenErrorCountDto.php @@ -0,0 +1,416 @@ + + */ +class UnseenErrorCountDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UnseenErrorCountDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count count + * + * @return self + */ + public function setCount($count) + { + + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UpdateAliasOptions.php b/lib/Models/UpdateAliasOptions.php new file mode 100644 index 00000000..3265b8f1 --- /dev/null +++ b/lib/Models/UpdateAliasOptions.php @@ -0,0 +1,420 @@ + + */ +class UpdateAliasOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateAliasOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Optional name for alias + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UpdateDomainOptions.php b/lib/Models/UpdateDomainOptions.php new file mode 100644 index 00000000..1437223c --- /dev/null +++ b/lib/Models/UpdateDomainOptions.php @@ -0,0 +1,420 @@ + + */ +class UpdateDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateDomainOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'catch_all_inbox_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'catch_all_inbox_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'catch_all_inbox_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'catch_all_inbox_id' => 'catchAllInboxId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'catch_all_inbox_id' => 'setCatchAllInboxId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'catch_all_inbox_id' => 'getCatchAllInboxId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('catch_all_inbox_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets catch_all_inbox_id + * + * @return string|null + */ + public function getCatchAllInboxId() + { + return $this->container['catch_all_inbox_id']; + } + + /** + * Sets catch_all_inbox_id + * + * @param string|null $catch_all_inbox_id catch_all_inbox_id + * + * @return self + */ + public function setCatchAllInboxId($catch_all_inbox_id) + { + + if (is_null($catch_all_inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('catch_all_inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['catch_all_inbox_id'] = $catch_all_inbox_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UpdateGroupContacts.php b/lib/Models/UpdateGroupContacts.php new file mode 100644 index 00000000..c956bba2 --- /dev/null +++ b/lib/Models/UpdateGroupContacts.php @@ -0,0 +1,416 @@ + + */ +class UpdateGroupContacts implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateGroupContacts'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contact_ids' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contact_ids' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contact_ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'contact_ids' => 'contactIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contact_ids' => 'setContactIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contact_ids' => 'getContactIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contact_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['contact_ids'] === null) { + $invalidProperties[] = "'contact_ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets contact_ids + * + * @return string[] + */ + public function getContactIds() + { + return $this->container['contact_ids']; + } + + /** + * Sets contact_ids + * + * @param string[] $contact_ids contact_ids + * + * @return self + */ + public function setContactIds($contact_ids) + { + + if (is_null($contact_ids)) { + throw new \InvalidArgumentException('non-nullable contact_ids cannot be null'); + } + + $this->container['contact_ids'] = $contact_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UpdateInboxOptions.php b/lib/Models/UpdateInboxOptions.php new file mode 100644 index 00000000..33dc455c --- /dev/null +++ b/lib/Models/UpdateInboxOptions.php @@ -0,0 +1,592 @@ + + */ +class UpdateInboxOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateInboxOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'tags' => 'string[]', + 'expires_at' => '\DateTime', + 'favourite' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'tags' => null, + 'expires_at' => 'date-time', + 'favourite' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'description' => true, + 'tags' => true, + 'expires_at' => true, + 'favourite' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'tags' => 'tags', + 'expires_at' => 'expiresAt', + 'favourite' => 'favourite' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'tags' => 'setTags', + 'expires_at' => 'setExpiresAt', + 'favourite' => 'setFavourite' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'tags' => 'getTags', + 'expires_at' => 'getExpiresAt', + 'favourite' => 'getFavourite' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('favourite', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of an inbox for labelling and searching purposes + * + * @return self + */ + public function setDescription($description) + { + + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + array_push($this->openAPINullablesSetToNull, 'tags'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tags', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets favourite + * + * @return bool|null + */ + public function getFavourite() + { + return $this->container['favourite']; + } + + /** + * Sets favourite + * + * @param bool|null $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering + * + * @return self + */ + public function setFavourite($favourite) + { + + if (is_null($favourite)) { + array_push($this->openAPINullablesSetToNull, 'favourite'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('favourite', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['favourite'] = $favourite; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UploadAttachmentBytesRequest.php b/lib/Models/UploadAttachmentBytesRequest.php new file mode 100644 index 00000000..109931e5 --- /dev/null +++ b/lib/Models/UploadAttachmentBytesRequest.php @@ -0,0 +1,665 @@ + + */ +class UploadAttachmentBytesRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'uploadAttachmentBytes_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'short' => 'int', + 'char' => 'string', + 'int' => 'int', + 'long' => 'int', + 'float' => 'float', + 'double' => 'float', + 'direct' => 'bool', + 'read_only' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'short' => 'int32', + 'char' => null, + 'int' => 'int32', + 'long' => 'int64', + 'float' => 'float', + 'double' => 'double', + 'direct' => null, + 'read_only' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'short' => false, + 'char' => false, + 'int' => false, + 'long' => false, + 'float' => false, + 'double' => false, + 'direct' => false, + 'read_only' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'short' => 'short', + 'char' => 'char', + 'int' => 'int', + 'long' => 'long', + 'float' => 'float', + 'double' => 'double', + 'direct' => 'direct', + 'read_only' => 'readOnly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'short' => 'setShort', + 'char' => 'setChar', + 'int' => 'setInt', + 'long' => 'setLong', + 'float' => 'setFloat', + 'double' => 'setDouble', + 'direct' => 'setDirect', + 'read_only' => 'setReadOnly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'short' => 'getShort', + 'char' => 'getChar', + 'int' => 'getInt', + 'long' => 'getLong', + 'float' => 'getFloat', + 'double' => 'getDouble', + 'direct' => 'getDirect', + 'read_only' => 'getReadOnly' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('short', $data ?? [], null); + $this->setIfExists('char', $data ?? [], null); + $this->setIfExists('int', $data ?? [], null); + $this->setIfExists('long', $data ?? [], null); + $this->setIfExists('float', $data ?? [], null); + $this->setIfExists('double', $data ?? [], null); + $this->setIfExists('direct', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets short + * + * @return int|null + */ + public function getShort() + { + return $this->container['short']; + } + + /** + * Sets short + * + * @param int|null $short short + * + * @return self + */ + public function setShort($short) + { + + if (is_null($short)) { + throw new \InvalidArgumentException('non-nullable short cannot be null'); + } + + $this->container['short'] = $short; + + return $this; + } + + /** + * Gets char + * + * @return string|null + */ + public function getChar() + { + return $this->container['char']; + } + + /** + * Sets char + * + * @param string|null $char char + * + * @return self + */ + public function setChar($char) + { + + if (is_null($char)) { + throw new \InvalidArgumentException('non-nullable char cannot be null'); + } + + $this->container['char'] = $char; + + return $this; + } + + /** + * Gets int + * + * @return int|null + */ + public function getInt() + { + return $this->container['int']; + } + + /** + * Sets int + * + * @param int|null $int int + * + * @return self + */ + public function setInt($int) + { + + if (is_null($int)) { + throw new \InvalidArgumentException('non-nullable int cannot be null'); + } + + $this->container['int'] = $int; + + return $this; + } + + /** + * Gets long + * + * @return int|null + */ + public function getLong() + { + return $this->container['long']; + } + + /** + * Sets long + * + * @param int|null $long long + * + * @return self + */ + public function setLong($long) + { + + if (is_null($long)) { + throw new \InvalidArgumentException('non-nullable long cannot be null'); + } + + $this->container['long'] = $long; + + return $this; + } + + /** + * Gets float + * + * @return float|null + */ + public function getFloat() + { + return $this->container['float']; + } + + /** + * Sets float + * + * @param float|null $float float + * + * @return self + */ + public function setFloat($float) + { + + if (is_null($float)) { + throw new \InvalidArgumentException('non-nullable float cannot be null'); + } + + $this->container['float'] = $float; + + return $this; + } + + /** + * Gets double + * + * @return float|null + */ + public function getDouble() + { + return $this->container['double']; + } + + /** + * Sets double + * + * @param float|null $double double + * + * @return self + */ + public function setDouble($double) + { + + if (is_null($double)) { + throw new \InvalidArgumentException('non-nullable double cannot be null'); + } + + $this->container['double'] = $double; + + return $this; + } + + /** + * Gets direct + * + * @return bool|null + */ + public function getDirect() + { + return $this->container['direct']; + } + + /** + * Sets direct + * + * @param bool|null $direct direct + * + * @return self + */ + public function setDirect($direct) + { + + if (is_null($direct)) { + throw new \InvalidArgumentException('non-nullable direct cannot be null'); + } + + $this->container['direct'] = $direct; + + return $this; + } + + /** + * Gets read_only + * + * @return bool|null + */ + public function getReadOnly() + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool|null $read_only read_only + * + * @return self + */ + public function setReadOnly($read_only) + { + + if (is_null($read_only)) { + throw new \InvalidArgumentException('non-nullable read_only cannot be null'); + } + + $this->container['read_only'] = $read_only; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UploadAttachmentOptions.php b/lib/Models/UploadAttachmentOptions.php new file mode 100644 index 00000000..d90c9468 --- /dev/null +++ b/lib/Models/UploadAttachmentOptions.php @@ -0,0 +1,502 @@ + + */ +class UploadAttachmentOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UploadAttachmentOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content_type' => 'string', + 'filename' => 'string', + 'base64_contents' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content_type' => null, + 'filename' => null, + 'base64_contents' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content_type' => true, + 'filename' => true, + 'base64_contents' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content_type' => 'contentType', + 'filename' => 'filename', + 'base64_contents' => 'base64Contents' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content_type' => 'setContentType', + 'filename' => 'setFilename', + 'base64_contents' => 'setBase64Contents' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content_type' => 'getContentType', + 'filename' => 'getFilename', + 'base64_contents' => 'getBase64Contents' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('base64_contents', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['base64_contents'] === null) { + $invalidProperties[] = "'base64_contents' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type Optional contentType for file. For instance `application/pdf` + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + array_push($this->openAPINullablesSetToNull, 'content_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('content_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename() + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Optional filename to save upload with. Will be the name that is shown in email clients + * + * @return self + */ + public function setFilename($filename) + { + + if (is_null($filename)) { + array_push($this->openAPINullablesSetToNull, 'filename'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filename', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['filename'] = $filename; + + return $this; + } + + /** + * Gets base64_contents + * + * @return string + */ + public function getBase64Contents() + { + return $this->container['base64_contents']; + } + + /** + * Sets base64_contents + * + * @param string $base64_contents Base64 encoded string of file contents. Typically this means reading the bytes or string content of a file and then converting that to a base64 encoded string. For examples of how to do this see https://www.mailslurp.com/guides/base64-file-uploads/ + * + * @return self + */ + public function setBase64Contents($base64_contents) + { + + if (is_null($base64_contents)) { + throw new \InvalidArgumentException('non-nullable base64_contents cannot be null'); + } + + $this->container['base64_contents'] = $base64_contents; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UploadMultipartFormRequest.php b/lib/Models/UploadMultipartFormRequest.php new file mode 100644 index 00000000..6415e8ac --- /dev/null +++ b/lib/Models/UploadMultipartFormRequest.php @@ -0,0 +1,451 @@ + + */ +class UploadMultipartFormRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'uploadMultipartForm_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content_type_header' => 'string', + 'file' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content_type_header' => null, + 'file' => 'binary' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content_type_header' => false, + 'file' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content_type_header' => 'contentTypeHeader', + 'file' => 'file' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content_type_header' => 'setContentTypeHeader', + 'file' => 'setFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content_type_header' => 'getContentTypeHeader', + 'file' => 'getFile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('content_type_header', $data ?? [], null); + $this->setIfExists('file', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['file'] === null) { + $invalidProperties[] = "'file' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content_type_header + * + * @return string|null + */ + public function getContentTypeHeader() + { + return $this->container['content_type_header']; + } + + /** + * Sets content_type_header + * + * @param string|null $content_type_header Optional content type header of attachment + * + * @return self + */ + public function setContentTypeHeader($content_type_header) + { + + if (is_null($content_type_header)) { + throw new \InvalidArgumentException('non-nullable content_type_header cannot be null'); + } + + $this->container['content_type_header'] = $content_type_header; + + return $this; + } + + /** + * Gets file + * + * @return \SplFileObject + */ + public function getFile() + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param \SplFileObject $file file + * + * @return self + */ + public function setFile($file) + { + + if (is_null($file)) { + throw new \InvalidArgumentException('non-nullable file cannot be null'); + } + + $this->container['file'] = $file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/UserInfoDto.php b/lib/Models/UserInfoDto.php new file mode 100644 index 00000000..5ad55b42 --- /dev/null +++ b/lib/Models/UserInfoDto.php @@ -0,0 +1,717 @@ + + */ +class UserInfoDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UserInfoDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'email_address' => 'string', + 'account_state' => 'string', + 'subscription_type' => 'string', + 'account_type' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'email_address' => null, + 'account_state' => null, + 'subscription_type' => null, + 'account_type' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email_address' => false, + 'account_state' => false, + 'subscription_type' => false, + 'account_type' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'email_address' => 'emailAddress', + 'account_state' => 'accountState', + 'subscription_type' => 'subscriptionType', + 'account_type' => 'accountType', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'email_address' => 'setEmailAddress', + 'account_state' => 'setAccountState', + 'subscription_type' => 'setSubscriptionType', + 'account_type' => 'setAccountType', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'email_address' => 'getEmailAddress', + 'account_state' => 'getAccountState', + 'subscription_type' => 'getSubscriptionType', + 'account_type' => 'getAccountType', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ACCOUNT_STATE_FROZEN = 'FROZEN'; + public const ACCOUNT_STATE_ACTIVE = 'ACTIVE'; + public const SUBSCRIPTION_TYPE_PRO_MONTHLY = 'PRO_MONTHLY'; + public const SUBSCRIPTION_TYPE_STARTER = 'STARTER'; + public const SUBSCRIPTION_TYPE_TEAM = 'TEAM'; + public const SUBSCRIPTION_TYPE_ENTERPRISE = 'ENTERPRISE'; + public const ACCOUNT_TYPE_SOLO = 'SOLO'; + public const ACCOUNT_TYPE_CHILD_SOLO = 'CHILD_SOLO'; + public const ACCOUNT_TYPE_CHILD_TEAM = 'CHILD_TEAM'; + public const ACCOUNT_TYPE_CHILD_ADMIN = 'CHILD_ADMIN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAccountStateAllowableValues() + { + return [ + self::ACCOUNT_STATE_FROZEN, + self::ACCOUNT_STATE_ACTIVE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSubscriptionTypeAllowableValues() + { + return [ + self::SUBSCRIPTION_TYPE_PRO_MONTHLY, + self::SUBSCRIPTION_TYPE_STARTER, + self::SUBSCRIPTION_TYPE_TEAM, + self::SUBSCRIPTION_TYPE_ENTERPRISE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAccountTypeAllowableValues() + { + return [ + self::ACCOUNT_TYPE_SOLO, + self::ACCOUNT_TYPE_CHILD_SOLO, + self::ACCOUNT_TYPE_CHILD_TEAM, + self::ACCOUNT_TYPE_CHILD_ADMIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('account_state', $data ?? [], null); + $this->setIfExists('subscription_type', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + if ($this->container['account_state'] === null) { + $invalidProperties[] = "'account_state' can't be null"; + } + $allowedValues = $this->getAccountStateAllowableValues(); + if (!is_null($this->container['account_state']) && !in_array($this->container['account_state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'account_state', must be one of '%s'", + $this->container['account_state'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSubscriptionTypeAllowableValues(); + if (!is_null($this->container['subscription_type']) && !in_array($this->container['subscription_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'subscription_type', must be one of '%s'", + $this->container['subscription_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['account_type'] === null) { + $invalidProperties[] = "'account_type' can't be null"; + } + $allowedValues = $this->getAccountTypeAllowableValues(); + if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'account_type', must be one of '%s'", + $this->container['account_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets account_state + * + * @return string + */ + public function getAccountState() + { + return $this->container['account_state']; + } + + /** + * Sets account_state + * + * @param string $account_state account_state + * + * @return self + */ + public function setAccountState($account_state) + { + $allowedValues = $this->getAccountStateAllowableValues(); + if (!in_array($account_state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'account_state', must be one of '%s'", + $account_state, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($account_state)) { + throw new \InvalidArgumentException('non-nullable account_state cannot be null'); + } + + $this->container['account_state'] = $account_state; + + return $this; + } + + /** + * Gets subscription_type + * + * @return string|null + */ + public function getSubscriptionType() + { + return $this->container['subscription_type']; + } + + /** + * Sets subscription_type + * + * @param string|null $subscription_type subscription_type + * + * @return self + */ + public function setSubscriptionType($subscription_type) + { + $allowedValues = $this->getSubscriptionTypeAllowableValues(); + if (!is_null($subscription_type) && !in_array($subscription_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'subscription_type', must be one of '%s'", + $subscription_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($subscription_type)) { + throw new \InvalidArgumentException('non-nullable subscription_type cannot be null'); + } + + $this->container['subscription_type'] = $subscription_type; + + return $this; + } + + /** + * Gets account_type + * + * @return string + */ + public function getAccountType() + { + return $this->container['account_type']; + } + + /** + * Sets account_type + * + * @param string $account_type account_type + * + * @return self + */ + public function setAccountType($account_type) + { + $allowedValues = $this->getAccountTypeAllowableValues(); + if (!in_array($account_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'account_type', must be one of '%s'", + $account_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } + + $this->container['account_type'] = $account_type; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ValidateEmailAddressListOptions.php b/lib/Models/ValidateEmailAddressListOptions.php new file mode 100644 index 00000000..8bc12e12 --- /dev/null +++ b/lib/Models/ValidateEmailAddressListOptions.php @@ -0,0 +1,431 @@ + + */ +class ValidateEmailAddressListOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidateEmailAddressListOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_address_list' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_address_list' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_address_list' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_address_list' => 'emailAddressList' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_address_list' => 'setEmailAddressList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_address_list' => 'getEmailAddressList' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_address_list', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_address_list'] === null) { + $invalidProperties[] = "'email_address_list' can't be null"; + } + if ((count($this->container['email_address_list']) > 50)) { + $invalidProperties[] = "invalid value for 'email_address_list', number of items must be less than or equal to 50."; + } + + if ((count($this->container['email_address_list']) < 1)) { + $invalidProperties[] = "invalid value for 'email_address_list', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_address_list + * + * @return string[] + */ + public function getEmailAddressList() + { + return $this->container['email_address_list']; + } + + /** + * Sets email_address_list + * + * @param string[] $email_address_list email_address_list + * + * @return self + */ + public function setEmailAddressList($email_address_list) + { + + if ((count($email_address_list) > 50)) { + throw new \InvalidArgumentException('invalid value for $email_address_list when calling ValidateEmailAddressListOptions., number of items must be less than or equal to 50.'); + } + if ((count($email_address_list) < 1)) { + throw new \InvalidArgumentException('invalid length for $email_address_list when calling ValidateEmailAddressListOptions., number of items must be greater than or equal to 1.'); + } + + if (is_null($email_address_list)) { + throw new \InvalidArgumentException('non-nullable email_address_list cannot be null'); + } + + $this->container['email_address_list'] = $email_address_list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ValidateEmailAddressListResult.php b/lib/Models/ValidateEmailAddressListResult.php new file mode 100644 index 00000000..bc1228d5 --- /dev/null +++ b/lib/Models/ValidateEmailAddressListResult.php @@ -0,0 +1,494 @@ + + */ +class ValidateEmailAddressListResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidateEmailAddressListResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'valid_email_addresses' => 'string[]', + 'invalid_email_addresses' => 'string[]', + 'result_map_email_address_is_valid' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'valid_email_addresses' => null, + 'invalid_email_addresses' => null, + 'result_map_email_address_is_valid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'valid_email_addresses' => false, + 'invalid_email_addresses' => false, + 'result_map_email_address_is_valid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'valid_email_addresses' => 'validEmailAddresses', + 'invalid_email_addresses' => 'invalidEmailAddresses', + 'result_map_email_address_is_valid' => 'resultMapEmailAddressIsValid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'valid_email_addresses' => 'setValidEmailAddresses', + 'invalid_email_addresses' => 'setInvalidEmailAddresses', + 'result_map_email_address_is_valid' => 'setResultMapEmailAddressIsValid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'valid_email_addresses' => 'getValidEmailAddresses', + 'invalid_email_addresses' => 'getInvalidEmailAddresses', + 'result_map_email_address_is_valid' => 'getResultMapEmailAddressIsValid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('valid_email_addresses', $data ?? [], null); + $this->setIfExists('invalid_email_addresses', $data ?? [], null); + $this->setIfExists('result_map_email_address_is_valid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['valid_email_addresses'] === null) { + $invalidProperties[] = "'valid_email_addresses' can't be null"; + } + if ($this->container['invalid_email_addresses'] === null) { + $invalidProperties[] = "'invalid_email_addresses' can't be null"; + } + if ($this->container['result_map_email_address_is_valid'] === null) { + $invalidProperties[] = "'result_map_email_address_is_valid' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets valid_email_addresses + * + * @return string[] + */ + public function getValidEmailAddresses() + { + return $this->container['valid_email_addresses']; + } + + /** + * Sets valid_email_addresses + * + * @param string[] $valid_email_addresses valid_email_addresses + * + * @return self + */ + public function setValidEmailAddresses($valid_email_addresses) + { + + if (is_null($valid_email_addresses)) { + throw new \InvalidArgumentException('non-nullable valid_email_addresses cannot be null'); + } + + $this->container['valid_email_addresses'] = $valid_email_addresses; + + return $this; + } + + /** + * Gets invalid_email_addresses + * + * @return string[] + */ + public function getInvalidEmailAddresses() + { + return $this->container['invalid_email_addresses']; + } + + /** + * Sets invalid_email_addresses + * + * @param string[] $invalid_email_addresses invalid_email_addresses + * + * @return self + */ + public function setInvalidEmailAddresses($invalid_email_addresses) + { + + if (is_null($invalid_email_addresses)) { + throw new \InvalidArgumentException('non-nullable invalid_email_addresses cannot be null'); + } + + $this->container['invalid_email_addresses'] = $invalid_email_addresses; + + return $this; + } + + /** + * Gets result_map_email_address_is_valid + * + * @return array + */ + public function getResultMapEmailAddressIsValid() + { + return $this->container['result_map_email_address_is_valid']; + } + + /** + * Sets result_map_email_address_is_valid + * + * @param array $result_map_email_address_is_valid result_map_email_address_is_valid + * + * @return self + */ + public function setResultMapEmailAddressIsValid($result_map_email_address_is_valid) + { + + if (is_null($result_map_email_address_is_valid)) { + throw new \InvalidArgumentException('non-nullable result_map_email_address_is_valid cannot be null'); + } + + $this->container['result_map_email_address_is_valid'] = $result_map_email_address_is_valid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ValidationDto.php b/lib/Models/ValidationDto.php new file mode 100644 index 00000000..531364f5 --- /dev/null +++ b/lib/Models/ValidationDto.php @@ -0,0 +1,455 @@ + + */ +class ValidationDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_id' => 'string', + 'html' => '\MailSlurp\Models\HTMLValidationResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_id' => 'uuid', + 'html' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_id' => false, + 'html' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_id' => 'emailId', + 'html' => 'html' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_id' => 'setEmailId', + 'html' => 'setHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_id' => 'getEmailId', + 'html' => 'getHtml' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_id', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_id'] === null) { + $invalidProperties[] = "'email_id' can't be null"; + } + if ($this->container['html'] === null) { + $invalidProperties[] = "'html' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_id + * + * @return string + */ + public function getEmailId() + { + return $this->container['email_id']; + } + + /** + * Sets email_id + * + * @param string $email_id ID of the email validated + * + * @return self + */ + public function setEmailId($email_id) + { + + if (is_null($email_id)) { + throw new \InvalidArgumentException('non-nullable email_id cannot be null'); + } + + $this->container['email_id'] = $email_id; + + return $this; + } + + /** + * Gets html + * + * @return \MailSlurp\Models\HTMLValidationResult + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param \MailSlurp\Models\HTMLValidationResult $html html + * + * @return self + */ + public function setHtml($html) + { + + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + + $this->container['html'] = $html; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/ValidationMessage.php b/lib/Models/ValidationMessage.php new file mode 100644 index 00000000..06485ee5 --- /dev/null +++ b/lib/Models/ValidationMessage.php @@ -0,0 +1,452 @@ + + */ +class ValidationMessage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationMessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'line_number' => 'int', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'line_number' => 'int32', + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'line_number' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'line_number' => 'lineNumber', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'line_number' => 'setLineNumber', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'line_number' => 'getLineNumber', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('line_number', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['line_number'] === null) { + $invalidProperties[] = "'line_number' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets line_number + * + * @return int + */ + public function getLineNumber() + { + return $this->container['line_number']; + } + + /** + * Sets line_number + * + * @param int $line_number line_number + * + * @return self + */ + public function setLineNumber($line_number) + { + + if (is_null($line_number)) { + throw new \InvalidArgumentException('non-nullable line_number cannot be null'); + } + + $this->container['line_number'] = $line_number; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/VerifyEmailAddressOptions.php b/lib/Models/VerifyEmailAddressOptions.php new file mode 100644 index 00000000..62e5c3d6 --- /dev/null +++ b/lib/Models/VerifyEmailAddressOptions.php @@ -0,0 +1,545 @@ + + */ +class VerifyEmailAddressOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VerifyEmailAddressOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mail_server_domain' => 'string', + 'email_address' => 'string', + 'sender_email_address' => 'string', + 'port' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mail_server_domain' => null, + 'email_address' => null, + 'sender_email_address' => null, + 'port' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mail_server_domain' => true, + 'email_address' => false, + 'sender_email_address' => true, + 'port' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mail_server_domain' => 'mailServerDomain', + 'email_address' => 'emailAddress', + 'sender_email_address' => 'senderEmailAddress', + 'port' => 'port' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mail_server_domain' => 'setMailServerDomain', + 'email_address' => 'setEmailAddress', + 'sender_email_address' => 'setSenderEmailAddress', + 'port' => 'setPort' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mail_server_domain' => 'getMailServerDomain', + 'email_address' => 'getEmailAddress', + 'sender_email_address' => 'getSenderEmailAddress', + 'port' => 'getPort' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mail_server_domain', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('sender_email_address', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['email_address'] === null) { + $invalidProperties[] = "'email_address' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mail_server_domain + * + * @return string|null + */ + public function getMailServerDomain() + { + return $this->container['mail_server_domain']; + } + + /** + * Sets mail_server_domain + * + * @param string|null $mail_server_domain mail_server_domain + * + * @return self + */ + public function setMailServerDomain($mail_server_domain) + { + + if (is_null($mail_server_domain)) { + array_push($this->openAPINullablesSetToNull, 'mail_server_domain'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mail_server_domain', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['mail_server_domain'] = $mail_server_domain; + + return $this; + } + + /** + * Gets email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->container['email_address']; + } + + /** + * Sets email_address + * + * @param string $email_address email_address + * + * @return self + */ + public function setEmailAddress($email_address) + { + + if (is_null($email_address)) { + throw new \InvalidArgumentException('non-nullable email_address cannot be null'); + } + + $this->container['email_address'] = $email_address; + + return $this; + } + + /** + * Gets sender_email_address + * + * @return string|null + */ + public function getSenderEmailAddress() + { + return $this->container['sender_email_address']; + } + + /** + * Sets sender_email_address + * + * @param string|null $sender_email_address sender_email_address + * + * @return self + */ + public function setSenderEmailAddress($sender_email_address) + { + + if (is_null($sender_email_address)) { + array_push($this->openAPINullablesSetToNull, 'sender_email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sender_email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sender_email_address'] = $sender_email_address; + + return $this; + } + + /** + * Gets port + * + * @return int|null + */ + public function getPort() + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param int|null $port port + * + * @return self + */ + public function setPort($port) + { + + if (is_null($port)) { + array_push($this->openAPINullablesSetToNull, 'port'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('port', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['port'] = $port; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/VerifyWebhookSignatureOptions.php b/lib/Models/VerifyWebhookSignatureOptions.php new file mode 100644 index 00000000..021e968c --- /dev/null +++ b/lib/Models/VerifyWebhookSignatureOptions.php @@ -0,0 +1,454 @@ + + */ +class VerifyWebhookSignatureOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VerifyWebhookSignatureOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'signature' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'signature' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'signature' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'signature' => 'signature' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'signature' => 'setSignature' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'signature' => 'getSignature' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['signature'] === null) { + $invalidProperties[] = "'signature' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id message_id + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets signature + * + * @return string + */ + public function getSignature() + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param string $signature signature + * + * @return self + */ + public function setSignature($signature) + { + + if (is_null($signature)) { + throw new \InvalidArgumentException('non-nullable signature cannot be null'); + } + + $this->container['signature'] = $signature; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/VerifyWebhookSignatureResults.php b/lib/Models/VerifyWebhookSignatureResults.php new file mode 100644 index 00000000..c141f030 --- /dev/null +++ b/lib/Models/VerifyWebhookSignatureResults.php @@ -0,0 +1,415 @@ + + */ +class VerifyWebhookSignatureResults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VerifyWebhookSignatureResults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is_valid' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is_valid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_valid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is_valid' => 'isValid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_valid' => 'setIsValid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_valid' => 'getIsValid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('is_valid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['is_valid'] === null) { + $invalidProperties[] = "'is_valid' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_valid + * + * @return bool + */ + public function getIsValid() + { + return $this->container['is_valid']; + } + + /** + * Sets is_valid + * + * @param bool $is_valid is_valid + * + * @return self + */ + public function setIsValid($is_valid) + { + + if (is_null($is_valid)) { + throw new \InvalidArgumentException('non-nullable is_valid cannot be null'); + } + + $this->container['is_valid'] = $is_valid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WaitForConditions.php b/lib/Models/WaitForConditions.php new file mode 100644 index 00000000..4edaa4ba --- /dev/null +++ b/lib/Models/WaitForConditions.php @@ -0,0 +1,867 @@ + + */ +class WaitForConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WaitForConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inbox_id' => 'string', + 'count' => 'int', + 'delay_timeout' => 'int', + 'timeout' => 'int', + 'unread_only' => 'bool', + 'count_type' => 'string', + 'matches' => '\MailSlurp\Models\MatchOption[]', + 'sort_direction' => 'string', + 'since' => '\DateTime', + 'before' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inbox_id' => 'uuid', + 'count' => 'int32', + 'delay_timeout' => 'int64', + 'timeout' => 'int64', + 'unread_only' => null, + 'count_type' => null, + 'matches' => null, + 'sort_direction' => null, + 'since' => 'date-time', + 'before' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inbox_id' => false, + 'count' => true, + 'delay_timeout' => true, + 'timeout' => false, + 'unread_only' => true, + 'count_type' => true, + 'matches' => true, + 'sort_direction' => true, + 'since' => true, + 'before' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inbox_id' => 'inboxId', + 'count' => 'count', + 'delay_timeout' => 'delayTimeout', + 'timeout' => 'timeout', + 'unread_only' => 'unreadOnly', + 'count_type' => 'countType', + 'matches' => 'matches', + 'sort_direction' => 'sortDirection', + 'since' => 'since', + 'before' => 'before' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inbox_id' => 'setInboxId', + 'count' => 'setCount', + 'delay_timeout' => 'setDelayTimeout', + 'timeout' => 'setTimeout', + 'unread_only' => 'setUnreadOnly', + 'count_type' => 'setCountType', + 'matches' => 'setMatches', + 'sort_direction' => 'setSortDirection', + 'since' => 'setSince', + 'before' => 'setBefore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inbox_id' => 'getInboxId', + 'count' => 'getCount', + 'delay_timeout' => 'getDelayTimeout', + 'timeout' => 'getTimeout', + 'unread_only' => 'getUnreadOnly', + 'count_type' => 'getCountType', + 'matches' => 'getMatches', + 'sort_direction' => 'getSortDirection', + 'since' => 'getSince', + 'before' => 'getBefore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const COUNT_TYPE_EXACTLY = 'EXACTLY'; + public const COUNT_TYPE_ATLEAST = 'ATLEAST'; + public const SORT_DIRECTION_ASC = 'ASC'; + public const SORT_DIRECTION_DESC = 'DESC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCountTypeAllowableValues() + { + return [ + self::COUNT_TYPE_EXACTLY, + self::COUNT_TYPE_ATLEAST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSortDirectionAllowableValues() + { + return [ + self::SORT_DIRECTION_ASC, + self::SORT_DIRECTION_DESC, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('delay_timeout', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('unread_only', $data ?? [], null); + $this->setIfExists('count_type', $data ?? [], null); + $this->setIfExists('matches', $data ?? [], null); + $this->setIfExists('sort_direction', $data ?? [], null); + $this->setIfExists('since', $data ?? [], null); + $this->setIfExists('before', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' can't be null"; + } + $allowedValues = $this->getCountTypeAllowableValues(); + if (!is_null($this->container['count_type']) && !in_array($this->container['count_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'count_type', must be one of '%s'", + $this->container['count_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sort_direction', must be one of '%s'", + $this->container['sort_direction'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id ID of inbox to search within and apply conditions to. Essentially filtering the emails found to give a count. + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation. + * + * @return self + */ + public function setCount($count) + { + + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets delay_timeout + * + * @return int|null + */ + public function getDelayTimeout() + { + return $this->container['delay_timeout']; + } + + /** + * Sets delay_timeout + * + * @param int|null $delay_timeout Max time in milliseconds to wait between retries if a `timeout` is specified. + * + * @return self + */ + public function setDelayTimeout($delay_timeout) + { + + if (is_null($delay_timeout)) { + array_push($this->openAPINullablesSetToNull, 'delay_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('delay_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['delay_timeout'] = $delay_timeout; + + return $this; + } + + /** + * Gets timeout + * + * @return int + */ + public function getTimeout() + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param int $timeout Max time in milliseconds to retry the `waitFor` operation until conditions are met. + * + * @return self + */ + public function setTimeout($timeout) + { + + if (is_null($timeout)) { + throw new \InvalidArgumentException('non-nullable timeout cannot be null'); + } + + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets unread_only + * + * @return bool|null + */ + public function getUnreadOnly() + { + return $this->container['unread_only']; + } + + /** + * Sets unread_only + * + * @param bool|null $unread_only Apply conditions only to **unread** emails. All emails begin with `read=false`. An email is marked `read=true` when an `EmailDto` representation of it has been returned to the user at least once. For example you have called `getEmail` or `waitForLatestEmail` etc., or you have viewed the email in the dashboard. + * + * @return self + */ + public function setUnreadOnly($unread_only) + { + + if (is_null($unread_only)) { + array_push($this->openAPINullablesSetToNull, 'unread_only'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unread_only', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['unread_only'] = $unread_only; + + return $this; + } + + /** + * Gets count_type + * + * @return string|null + */ + public function getCountType() + { + return $this->container['count_type']; + } + + /** + * Sets count_type + * + * @param string|null $count_type How result size should be compared with the expected size. Exactly or at-least matching result? + * + * @return self + */ + public function setCountType($count_type) + { + $allowedValues = $this->getCountTypeAllowableValues(); + if (!is_null($count_type) && !in_array($count_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'count_type', must be one of '%s'", + $count_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($count_type)) { + array_push($this->openAPINullablesSetToNull, 'count_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['count_type'] = $count_type; + + return $this; + } + + /** + * Gets matches + * + * @return \MailSlurp\Models\MatchOption[]|null + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param \MailSlurp\Models\MatchOption[]|null $matches Conditions that should be matched for an email to qualify for results. Each condition will be applied in order to each email within an inbox to filter a result list of matching emails you are waiting for. + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + array_push($this->openAPINullablesSetToNull, 'matches'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('matches', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['matches'] = $matches; + + return $this; + } + + /** + * Gets sort_direction + * + * @return string|null + */ + public function getSortDirection() + { + return $this->container['sort_direction']; + } + + /** + * Sets sort_direction + * + * @param string|null $sort_direction Direction to sort matching emails by created time + * + * @return self + */ + public function setSortDirection($sort_direction) + { + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sort_direction', must be one of '%s'", + $sort_direction, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($sort_direction)) { + array_push($this->openAPINullablesSetToNull, 'sort_direction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sort_direction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sort_direction'] = $sort_direction; + + return $this; + } + + /** + * Gets since + * + * @return \DateTime|null + */ + public function getSince() + { + return $this->container['since']; + } + + /** + * Sets since + * + * @param \DateTime|null $since ISO Date Time earliest time of email to consider. Filter for matching emails that were received after this date + * + * @return self + */ + public function setSince($since) + { + + if (is_null($since)) { + array_push($this->openAPINullablesSetToNull, 'since'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('since', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['since'] = $since; + + return $this; + } + + /** + * Gets before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before ISO Date Time latest time of email to consider. Filter for matching emails that were received before this date + * + * @return self + */ + public function setBefore($before) + { + + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['before'] = $before; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WaitForSingleSmsOptions.php b/lib/Models/WaitForSingleSmsOptions.php new file mode 100644 index 00000000..a367831c --- /dev/null +++ b/lib/Models/WaitForSingleSmsOptions.php @@ -0,0 +1,668 @@ + + */ +class WaitForSingleSmsOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WaitForSingleSmsOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phone_number_id' => 'string', + 'timeout' => 'int', + 'unread_only' => 'bool', + 'before' => '\DateTime', + 'since' => '\DateTime', + 'sort_direction' => 'string', + 'delay' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phone_number_id' => 'uuid', + 'timeout' => 'int64', + 'unread_only' => null, + 'before' => 'date-time', + 'since' => 'date-time', + 'sort_direction' => null, + 'delay' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phone_number_id' => false, + 'timeout' => false, + 'unread_only' => false, + 'before' => false, + 'since' => false, + 'sort_direction' => false, + 'delay' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phone_number_id' => 'phoneNumberId', + 'timeout' => 'timeout', + 'unread_only' => 'unreadOnly', + 'before' => 'before', + 'since' => 'since', + 'sort_direction' => 'sortDirection', + 'delay' => 'delay' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phone_number_id' => 'setPhoneNumberId', + 'timeout' => 'setTimeout', + 'unread_only' => 'setUnreadOnly', + 'before' => 'setBefore', + 'since' => 'setSince', + 'sort_direction' => 'setSortDirection', + 'delay' => 'setDelay' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phone_number_id' => 'getPhoneNumberId', + 'timeout' => 'getTimeout', + 'unread_only' => 'getUnreadOnly', + 'before' => 'getBefore', + 'since' => 'getSince', + 'sort_direction' => 'getSortDirection', + 'delay' => 'getDelay' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SORT_DIRECTION_ASC = 'ASC'; + public const SORT_DIRECTION_DESC = 'DESC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSortDirectionAllowableValues() + { + return [ + self::SORT_DIRECTION_ASC, + self::SORT_DIRECTION_DESC, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phone_number_id', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('unread_only', $data ?? [], null); + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('since', $data ?? [], null); + $this->setIfExists('sort_direction', $data ?? [], null); + $this->setIfExists('delay', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['phone_number_id'] === null) { + $invalidProperties[] = "'phone_number_id' can't be null"; + } + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' can't be null"; + } + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sort_direction', must be one of '%s'", + $this->container['sort_direction'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_number_id + * + * @return string + */ + public function getPhoneNumberId() + { + return $this->container['phone_number_id']; + } + + /** + * Sets phone_number_id + * + * @param string $phone_number_id phone_number_id + * + * @return self + */ + public function setPhoneNumberId($phone_number_id) + { + + if (is_null($phone_number_id)) { + throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null'); + } + + $this->container['phone_number_id'] = $phone_number_id; + + return $this; + } + + /** + * Gets timeout + * + * @return int + */ + public function getTimeout() + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param int $timeout timeout + * + * @return self + */ + public function setTimeout($timeout) + { + + if (is_null($timeout)) { + throw new \InvalidArgumentException('non-nullable timeout cannot be null'); + } + + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets unread_only + * + * @return bool|null + */ + public function getUnreadOnly() + { + return $this->container['unread_only']; + } + + /** + * Sets unread_only + * + * @param bool|null $unread_only unread_only + * + * @return self + */ + public function setUnreadOnly($unread_only) + { + + if (is_null($unread_only)) { + throw new \InvalidArgumentException('non-nullable unread_only cannot be null'); + } + + $this->container['unread_only'] = $unread_only; + + return $this; + } + + /** + * Gets before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before before + * + * @return self + */ + public function setBefore($before) + { + + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } + + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets since + * + * @return \DateTime|null + */ + public function getSince() + { + return $this->container['since']; + } + + /** + * Sets since + * + * @param \DateTime|null $since since + * + * @return self + */ + public function setSince($since) + { + + if (is_null($since)) { + throw new \InvalidArgumentException('non-nullable since cannot be null'); + } + + $this->container['since'] = $since; + + return $this; + } + + /** + * Gets sort_direction + * + * @return string|null + */ + public function getSortDirection() + { + return $this->container['sort_direction']; + } + + /** + * Sets sort_direction + * + * @param string|null $sort_direction sort_direction + * + * @return self + */ + public function setSortDirection($sort_direction) + { + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sort_direction', must be one of '%s'", + $sort_direction, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($sort_direction)) { + throw new \InvalidArgumentException('non-nullable sort_direction cannot be null'); + } + + $this->container['sort_direction'] = $sort_direction; + + return $this; + } + + /** + * Gets delay + * + * @return int|null + */ + public function getDelay() + { + return $this->container['delay']; + } + + /** + * Sets delay + * + * @param int|null $delay delay + * + * @return self + */ + public function setDelay($delay) + { + + if (is_null($delay)) { + throw new \InvalidArgumentException('non-nullable delay cannot be null'); + } + + $this->container['delay'] = $delay; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WaitForSmsConditions.php b/lib/Models/WaitForSmsConditions.php new file mode 100644 index 00000000..f592750e --- /dev/null +++ b/lib/Models/WaitForSmsConditions.php @@ -0,0 +1,906 @@ + + */ +class WaitForSmsConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WaitForSmsConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phone_number_id' => 'string', + 'limit' => 'int', + 'count' => 'int', + 'delay_timeout' => 'int', + 'timeout' => 'int', + 'unread_only' => 'bool', + 'count_type' => 'string', + 'matches' => '\MailSlurp\Models\SmsMatchOption[]', + 'sort_direction' => 'string', + 'since' => '\DateTime', + 'before' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phone_number_id' => 'uuid', + 'limit' => 'int32', + 'count' => 'int64', + 'delay_timeout' => 'int64', + 'timeout' => 'int64', + 'unread_only' => null, + 'count_type' => null, + 'matches' => null, + 'sort_direction' => null, + 'since' => 'date-time', + 'before' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phone_number_id' => false, + 'limit' => true, + 'count' => false, + 'delay_timeout' => true, + 'timeout' => false, + 'unread_only' => true, + 'count_type' => true, + 'matches' => true, + 'sort_direction' => true, + 'since' => true, + 'before' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phone_number_id' => 'phoneNumberId', + 'limit' => 'limit', + 'count' => 'count', + 'delay_timeout' => 'delayTimeout', + 'timeout' => 'timeout', + 'unread_only' => 'unreadOnly', + 'count_type' => 'countType', + 'matches' => 'matches', + 'sort_direction' => 'sortDirection', + 'since' => 'since', + 'before' => 'before' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phone_number_id' => 'setPhoneNumberId', + 'limit' => 'setLimit', + 'count' => 'setCount', + 'delay_timeout' => 'setDelayTimeout', + 'timeout' => 'setTimeout', + 'unread_only' => 'setUnreadOnly', + 'count_type' => 'setCountType', + 'matches' => 'setMatches', + 'sort_direction' => 'setSortDirection', + 'since' => 'setSince', + 'before' => 'setBefore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phone_number_id' => 'getPhoneNumberId', + 'limit' => 'getLimit', + 'count' => 'getCount', + 'delay_timeout' => 'getDelayTimeout', + 'timeout' => 'getTimeout', + 'unread_only' => 'getUnreadOnly', + 'count_type' => 'getCountType', + 'matches' => 'getMatches', + 'sort_direction' => 'getSortDirection', + 'since' => 'getSince', + 'before' => 'getBefore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const COUNT_TYPE_EXACTLY = 'EXACTLY'; + public const COUNT_TYPE_ATLEAST = 'ATLEAST'; + public const SORT_DIRECTION_ASC = 'ASC'; + public const SORT_DIRECTION_DESC = 'DESC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCountTypeAllowableValues() + { + return [ + self::COUNT_TYPE_EXACTLY, + self::COUNT_TYPE_ATLEAST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSortDirectionAllowableValues() + { + return [ + self::SORT_DIRECTION_ASC, + self::SORT_DIRECTION_DESC, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phone_number_id', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('delay_timeout', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('unread_only', $data ?? [], null); + $this->setIfExists('count_type', $data ?? [], null); + $this->setIfExists('matches', $data ?? [], null); + $this->setIfExists('sort_direction', $data ?? [], null); + $this->setIfExists('since', $data ?? [], null); + $this->setIfExists('before', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['phone_number_id'] === null) { + $invalidProperties[] = "'phone_number_id' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' can't be null"; + } + $allowedValues = $this->getCountTypeAllowableValues(); + if (!is_null($this->container['count_type']) && !in_array($this->container['count_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'count_type', must be one of '%s'", + $this->container['count_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sort_direction', must be one of '%s'", + $this->container['sort_direction'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_number_id + * + * @return string + */ + public function getPhoneNumberId() + { + return $this->container['phone_number_id']; + } + + /** + * Sets phone_number_id + * + * @param string $phone_number_id ID of phone number to search within and apply conditions to. Essentially filtering the SMS found to give a count. + * + * @return self + */ + public function setPhoneNumberId($phone_number_id) + { + + if (is_null($phone_number_id)) { + throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null'); + } + + $this->container['phone_number_id'] = $phone_number_id; + + return $this; + } + + /** + * Gets limit + * + * @return int|null + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int|null $limit Limit results + * + * @return self + */ + public function setLimit($limit) + { + + if (is_null($limit)) { + array_push($this->openAPINullablesSetToNull, 'limit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('limit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation. + * + * @return self + */ + public function setCount($count) + { + + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets delay_timeout + * + * @return int|null + */ + public function getDelayTimeout() + { + return $this->container['delay_timeout']; + } + + /** + * Sets delay_timeout + * + * @param int|null $delay_timeout Max time in milliseconds to wait between retries if a `timeout` is specified. + * + * @return self + */ + public function setDelayTimeout($delay_timeout) + { + + if (is_null($delay_timeout)) { + array_push($this->openAPINullablesSetToNull, 'delay_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('delay_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['delay_timeout'] = $delay_timeout; + + return $this; + } + + /** + * Gets timeout + * + * @return int + */ + public function getTimeout() + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param int $timeout Max time in milliseconds to retry the `waitFor` operation until conditions are met. + * + * @return self + */ + public function setTimeout($timeout) + { + + if (is_null($timeout)) { + throw new \InvalidArgumentException('non-nullable timeout cannot be null'); + } + + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets unread_only + * + * @return bool|null + */ + public function getUnreadOnly() + { + return $this->container['unread_only']; + } + + /** + * Sets unread_only + * + * @param bool|null $unread_only Apply conditions only to **unread** SMS. All SMS messages begin with `read=false`. An SMS is marked `read=true` when an `SMS` has been returned to the user at least once. For example you have called `getSms` or `waitForSms` etc., or you have viewed the SMS in the dashboard. + * + * @return self + */ + public function setUnreadOnly($unread_only) + { + + if (is_null($unread_only)) { + array_push($this->openAPINullablesSetToNull, 'unread_only'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unread_only', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['unread_only'] = $unread_only; + + return $this; + } + + /** + * Gets count_type + * + * @return string|null + */ + public function getCountType() + { + return $this->container['count_type']; + } + + /** + * Sets count_type + * + * @param string|null $count_type How result size should be compared with the expected size. Exactly or at-least matching result? + * + * @return self + */ + public function setCountType($count_type) + { + $allowedValues = $this->getCountTypeAllowableValues(); + if (!is_null($count_type) && !in_array($count_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'count_type', must be one of '%s'", + $count_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($count_type)) { + array_push($this->openAPINullablesSetToNull, 'count_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['count_type'] = $count_type; + + return $this; + } + + /** + * Gets matches + * + * @return \MailSlurp\Models\SmsMatchOption[]|null + */ + public function getMatches() + { + return $this->container['matches']; + } + + /** + * Sets matches + * + * @param \MailSlurp\Models\SmsMatchOption[]|null $matches Conditions that should be matched for an SMS to qualify for results. Each condition will be applied in order to each SMS within a phone number to filter a result list of matching SMSs you are waiting for. + * + * @return self + */ + public function setMatches($matches) + { + + if (is_null($matches)) { + array_push($this->openAPINullablesSetToNull, 'matches'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('matches', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['matches'] = $matches; + + return $this; + } + + /** + * Gets sort_direction + * + * @return string|null + */ + public function getSortDirection() + { + return $this->container['sort_direction']; + } + + /** + * Sets sort_direction + * + * @param string|null $sort_direction Direction to sort matching SMSs by created time + * + * @return self + */ + public function setSortDirection($sort_direction) + { + $allowedValues = $this->getSortDirectionAllowableValues(); + if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sort_direction', must be one of '%s'", + $sort_direction, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($sort_direction)) { + array_push($this->openAPINullablesSetToNull, 'sort_direction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sort_direction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sort_direction'] = $sort_direction; + + return $this; + } + + /** + * Gets since + * + * @return \DateTime|null + */ + public function getSince() + { + return $this->container['since']; + } + + /** + * Sets since + * + * @param \DateTime|null $since ISO Date Time earliest time of SMS to consider. Filter for matching SMSs that were received after this date + * + * @return self + */ + public function setSince($since) + { + + if (is_null($since)) { + array_push($this->openAPINullablesSetToNull, 'since'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('since', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['since'] = $since; + + return $this; + } + + /** + * Gets before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before ISO Date Time latest time of SMS to consider. Filter for matching SMSs that were received before this date + * + * @return self + */ + public function setBefore($before) + { + + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['before'] = $before; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookBouncePayload.php b/lib/Models/WebhookBouncePayload.php new file mode 100644 index 00000000..3947f7ec --- /dev/null +++ b/lib/Models/WebhookBouncePayload.php @@ -0,0 +1,751 @@ + + */ +class WebhookBouncePayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookBouncePayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'bounce_id' => 'string', + 'sent_to_recipients' => 'string[]', + 'sender' => 'string', + 'bounce_recipients' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'bounce_id' => 'uuid', + 'sent_to_recipients' => null, + 'sender' => null, + 'bounce_recipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'bounce_id' => false, + 'sent_to_recipients' => true, + 'sender' => false, + 'bounce_recipients' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'bounce_id' => 'bounceId', + 'sent_to_recipients' => 'sentToRecipients', + 'sender' => 'sender', + 'bounce_recipients' => 'bounceRecipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'bounce_id' => 'setBounceId', + 'sent_to_recipients' => 'setSentToRecipients', + 'sender' => 'setSender', + 'bounce_recipients' => 'setBounceRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'bounce_id' => 'getBounceId', + 'sent_to_recipients' => 'getSentToRecipients', + 'sender' => 'getSender', + 'bounce_recipients' => 'getBounceRecipients' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('bounce_id', $data ?? [], null); + $this->setIfExists('sent_to_recipients', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('bounce_recipients', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['bounce_id'] === null) { + $invalidProperties[] = "'bounce_id' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets bounce_id + * + * @return string + */ + public function getBounceId() + { + return $this->container['bounce_id']; + } + + /** + * Sets bounce_id + * + * @param string $bounce_id ID of the bounce email record. Use the ID with the bounce controller to view more information + * + * @return self + */ + public function setBounceId($bounce_id) + { + + if (is_null($bounce_id)) { + throw new \InvalidArgumentException('non-nullable bounce_id cannot be null'); + } + + $this->container['bounce_id'] = $bounce_id; + + return $this; + } + + /** + * Gets sent_to_recipients + * + * @return string[]|null + */ + public function getSentToRecipients() + { + return $this->container['sent_to_recipients']; + } + + /** + * Sets sent_to_recipients + * + * @param string[]|null $sent_to_recipients Email sent to recipients + * + * @return self + */ + public function setSentToRecipients($sent_to_recipients) + { + + if (is_null($sent_to_recipients)) { + array_push($this->openAPINullablesSetToNull, 'sent_to_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_to_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_to_recipients'] = $sent_to_recipients; + + return $this; + } + + /** + * Gets sender + * + * @return string + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string $sender Sender causing bounce + * + * @return self + */ + public function setSender($sender) + { + + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets bounce_recipients + * + * @return string[]|null + */ + public function getBounceRecipients() + { + return $this->container['bounce_recipients']; + } + + /** + * Sets bounce_recipients + * + * @param string[]|null $bounce_recipients Email addresses that resulted in a bounce or email being rejected. Please save these recipients and avoid emailing them in the future to maintain your reputation. + * + * @return self + */ + public function setBounceRecipients($bounce_recipients) + { + + if (is_null($bounce_recipients)) { + array_push($this->openAPINullablesSetToNull, 'bounce_recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bounce_recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['bounce_recipients'] = $bounce_recipients; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookBounceRecipientPayload.php b/lib/Models/WebhookBounceRecipientPayload.php new file mode 100644 index 00000000..8545f071 --- /dev/null +++ b/lib/Models/WebhookBounceRecipientPayload.php @@ -0,0 +1,626 @@ + + */ +class WebhookBounceRecipientPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookBounceRecipientPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'recipient' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'recipient' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'recipient' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'recipient' => 'recipient' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'recipient' => 'setRecipient' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'recipient' => 'getRecipient' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['recipient'] === null) { + $invalidProperties[] = "'recipient' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets recipient + * + * @return string + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string $recipient Email address that caused a bounce. Make note of the address and try not to message it again to preserve your reputation. + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + throw new \InvalidArgumentException('non-nullable recipient cannot be null'); + } + + $this->container['recipient'] = $recipient; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookDeliveryStatusPayload.php b/lib/Models/WebhookDeliveryStatusPayload.php new file mode 100644 index 00000000..12e5a7ba --- /dev/null +++ b/lib/Models/WebhookDeliveryStatusPayload.php @@ -0,0 +1,1095 @@ + + */ +class WebhookDeliveryStatusPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookDeliveryStatusPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'id' => 'string', + 'user_id' => 'string', + 'sent_id' => 'string', + 'remote_mta_ip' => 'string', + 'inbox_id' => 'string', + 'reporting_mta' => 'string', + 'recipients' => 'string[]', + 'smtp_response' => 'string', + 'smtp_status_code' => 'int', + 'processing_time_millis' => 'int', + 'received' => '\DateTime', + 'subject' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'id' => 'uuid', + 'user_id' => 'uuid', + 'sent_id' => 'uuid', + 'remote_mta_ip' => null, + 'inbox_id' => 'uuid', + 'reporting_mta' => null, + 'recipients' => null, + 'smtp_response' => null, + 'smtp_status_code' => 'int32', + 'processing_time_millis' => 'int64', + 'received' => 'date-time', + 'subject' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'id' => false, + 'user_id' => false, + 'sent_id' => true, + 'remote_mta_ip' => true, + 'inbox_id' => true, + 'reporting_mta' => true, + 'recipients' => true, + 'smtp_response' => true, + 'smtp_status_code' => true, + 'processing_time_millis' => true, + 'received' => true, + 'subject' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'id' => 'id', + 'user_id' => 'userId', + 'sent_id' => 'sentId', + 'remote_mta_ip' => 'remoteMtaIp', + 'inbox_id' => 'inboxId', + 'reporting_mta' => 'reportingMta', + 'recipients' => 'recipients', + 'smtp_response' => 'smtpResponse', + 'smtp_status_code' => 'smtpStatusCode', + 'processing_time_millis' => 'processingTimeMillis', + 'received' => 'received', + 'subject' => 'subject' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'id' => 'setId', + 'user_id' => 'setUserId', + 'sent_id' => 'setSentId', + 'remote_mta_ip' => 'setRemoteMtaIp', + 'inbox_id' => 'setInboxId', + 'reporting_mta' => 'setReportingMta', + 'recipients' => 'setRecipients', + 'smtp_response' => 'setSmtpResponse', + 'smtp_status_code' => 'setSmtpStatusCode', + 'processing_time_millis' => 'setProcessingTimeMillis', + 'received' => 'setReceived', + 'subject' => 'setSubject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'id' => 'getId', + 'user_id' => 'getUserId', + 'sent_id' => 'getSentId', + 'remote_mta_ip' => 'getRemoteMtaIp', + 'inbox_id' => 'getInboxId', + 'reporting_mta' => 'getReportingMta', + 'recipients' => 'getRecipients', + 'smtp_response' => 'getSmtpResponse', + 'smtp_status_code' => 'getSmtpStatusCode', + 'processing_time_millis' => 'getProcessingTimeMillis', + 'received' => 'getReceived', + 'subject' => 'getSubject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('sent_id', $data ?? [], null); + $this->setIfExists('remote_mta_ip', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('reporting_mta', $data ?? [], null); + $this->setIfExists('recipients', $data ?? [], null); + $this->setIfExists('smtp_response', $data ?? [], null); + $this->setIfExists('smtp_status_code', $data ?? [], null); + $this->setIfExists('processing_time_millis', $data ?? [], null); + $this->setIfExists('received', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of delivery status + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id User ID of event + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets sent_id + * + * @return string|null + */ + public function getSentId() + { + return $this->container['sent_id']; + } + + /** + * Sets sent_id + * + * @param string|null $sent_id ID of sent email + * + * @return self + */ + public function setSentId($sent_id) + { + + if (is_null($sent_id)) { + array_push($this->openAPINullablesSetToNull, 'sent_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sent_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['sent_id'] = $sent_id; + + return $this; + } + + /** + * Gets remote_mta_ip + * + * @return string|null + */ + public function getRemoteMtaIp() + { + return $this->container['remote_mta_ip']; + } + + /** + * Sets remote_mta_ip + * + * @param string|null $remote_mta_ip IP address of the remote Mail Transfer Agent + * + * @return self + */ + public function setRemoteMtaIp($remote_mta_ip) + { + + if (is_null($remote_mta_ip)) { + array_push($this->openAPINullablesSetToNull, 'remote_mta_ip'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('remote_mta_ip', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['remote_mta_ip'] = $remote_mta_ip; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id Id of the inbox + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets reporting_mta + * + * @return string|null + */ + public function getReportingMta() + { + return $this->container['reporting_mta']; + } + + /** + * Sets reporting_mta + * + * @param string|null $reporting_mta Mail Transfer Agent reporting delivery status + * + * @return self + */ + public function setReportingMta($reporting_mta) + { + + if (is_null($reporting_mta)) { + array_push($this->openAPINullablesSetToNull, 'reporting_mta'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reporting_mta', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['reporting_mta'] = $reporting_mta; + + return $this; + } + + /** + * Gets recipients + * + * @return string[]|null + */ + public function getRecipients() + { + return $this->container['recipients']; + } + + /** + * Sets recipients + * + * @param string[]|null $recipients Recipients for delivery + * + * @return self + */ + public function setRecipients($recipients) + { + + if (is_null($recipients)) { + array_push($this->openAPINullablesSetToNull, 'recipients'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recipients', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['recipients'] = $recipients; + + return $this; + } + + /** + * Gets smtp_response + * + * @return string|null + */ + public function getSmtpResponse() + { + return $this->container['smtp_response']; + } + + /** + * Sets smtp_response + * + * @param string|null $smtp_response SMTP server response message + * + * @return self + */ + public function setSmtpResponse($smtp_response) + { + + if (is_null($smtp_response)) { + array_push($this->openAPINullablesSetToNull, 'smtp_response'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('smtp_response', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['smtp_response'] = $smtp_response; + + return $this; + } + + /** + * Gets smtp_status_code + * + * @return int|null + */ + public function getSmtpStatusCode() + { + return $this->container['smtp_status_code']; + } + + /** + * Sets smtp_status_code + * + * @param int|null $smtp_status_code SMTP server status + * + * @return self + */ + public function setSmtpStatusCode($smtp_status_code) + { + + if (is_null($smtp_status_code)) { + array_push($this->openAPINullablesSetToNull, 'smtp_status_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('smtp_status_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['smtp_status_code'] = $smtp_status_code; + + return $this; + } + + /** + * Gets processing_time_millis + * + * @return int|null + */ + public function getProcessingTimeMillis() + { + return $this->container['processing_time_millis']; + } + + /** + * Sets processing_time_millis + * + * @param int|null $processing_time_millis Time in milliseconds for delivery processing + * + * @return self + */ + public function setProcessingTimeMillis($processing_time_millis) + { + + if (is_null($processing_time_millis)) { + array_push($this->openAPINullablesSetToNull, 'processing_time_millis'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('processing_time_millis', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['processing_time_millis'] = $processing_time_millis; + + return $this; + } + + /** + * Gets received + * + * @return \DateTime|null + */ + public function getReceived() + { + return $this->container['received']; + } + + /** + * Sets received + * + * @param \DateTime|null $received Time event was received + * + * @return self + */ + public function setReceived($received) + { + + if (is_null($received)) { + array_push($this->openAPINullablesSetToNull, 'received'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('received', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['received'] = $received; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Email subject + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookDto.php b/lib/Models/WebhookDto.php new file mode 100644 index 00000000..14fc5be2 --- /dev/null +++ b/lib/Models/WebhookDto.php @@ -0,0 +1,1043 @@ + + */ +class WebhookDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'basic_auth' => 'bool', + 'name' => 'string', + 'phone_id' => 'string', + 'inbox_id' => 'string', + 'request_body_template' => 'string', + 'url' => 'string', + 'method' => 'string', + 'payload_json_schema' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'event_name' => 'string', + 'request_headers' => '\MailSlurp\Models\WebhookHeaders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'basic_auth' => null, + 'name' => null, + 'phone_id' => 'uuid', + 'inbox_id' => 'uuid', + 'request_body_template' => null, + 'url' => null, + 'method' => null, + 'payload_json_schema' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'event_name' => null, + 'request_headers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user_id' => false, + 'basic_auth' => false, + 'name' => true, + 'phone_id' => true, + 'inbox_id' => true, + 'request_body_template' => true, + 'url' => false, + 'method' => false, + 'payload_json_schema' => false, + 'created_at' => true, + 'updated_at' => false, + 'event_name' => true, + 'request_headers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'basic_auth' => 'basicAuth', + 'name' => 'name', + 'phone_id' => 'phoneId', + 'inbox_id' => 'inboxId', + 'request_body_template' => 'requestBodyTemplate', + 'url' => 'url', + 'method' => 'method', + 'payload_json_schema' => 'payloadJsonSchema', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'event_name' => 'eventName', + 'request_headers' => 'requestHeaders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'basic_auth' => 'setBasicAuth', + 'name' => 'setName', + 'phone_id' => 'setPhoneId', + 'inbox_id' => 'setInboxId', + 'request_body_template' => 'setRequestBodyTemplate', + 'url' => 'setUrl', + 'method' => 'setMethod', + 'payload_json_schema' => 'setPayloadJsonSchema', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'event_name' => 'setEventName', + 'request_headers' => 'setRequestHeaders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'basic_auth' => 'getBasicAuth', + 'name' => 'getName', + 'phone_id' => 'getPhoneId', + 'inbox_id' => 'getInboxId', + 'request_body_template' => 'getRequestBodyTemplate', + 'url' => 'getUrl', + 'method' => 'getMethod', + 'payload_json_schema' => 'getPayloadJsonSchema', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'event_name' => 'getEventName', + 'request_headers' => 'getRequestHeaders' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const METHOD_GET = 'GET'; + public const METHOD_HEAD = 'HEAD'; + public const METHOD_POST = 'POST'; + public const METHOD_PUT = 'PUT'; + public const METHOD_PATCH = 'PATCH'; + public const METHOD_DELETE = 'DELETE'; + public const METHOD_OPTIONS = 'OPTIONS'; + public const METHOD_TRACE = 'TRACE'; + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMethodAllowableValues() + { + return [ + self::METHOD_GET, + self::METHOD_HEAD, + self::METHOD_POST, + self::METHOD_PUT, + self::METHOD_PATCH, + self::METHOD_DELETE, + self::METHOD_OPTIONS, + self::METHOD_TRACE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('phone_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('request_body_template', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('payload_json_schema', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('request_headers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['basic_auth'] === null) { + $invalidProperties[] = "'basic_auth' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['method'] === null) { + $invalidProperties[] = "'method' can't be null"; + } + $allowedValues = $this->getMethodAllowableValues(); + if (!is_null($this->container['method']) && !in_array($this->container['method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'method', must be one of '%s'", + $this->container['method'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['payload_json_schema'] === null) { + $invalidProperties[] = "'payload_json_schema' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the Webhook + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id User ID of the Webhook + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets basic_auth + * + * @return bool + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param bool $basic_auth Does webhook expect basic authentication? If true it means you created this webhook with a username and password. MailSlurp will use these in the URL to authenticate itself. + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + + if (is_null($basic_auth)) { + throw new \InvalidArgumentException('non-nullable basic_auth cannot be null'); + } + + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the webhook + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets phone_id + * + * @return string|null + */ + public function getPhoneId() + { + return $this->container['phone_id']; + } + + /** + * Sets phone_id + * + * @param string|null $phone_id The phoneNumberId that the Webhook will be triggered by. If null then webhook triggered at account level or inbox level if inboxId set + * + * @return self + */ + public function setPhoneId($phone_id) + { + + if (is_null($phone_id)) { + array_push($this->openAPINullablesSetToNull, 'phone_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['phone_id'] = $phone_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id The inbox that the Webhook will be triggered by. If null then webhook triggered at account level or phone level if phoneId set + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets request_body_template + * + * @return string|null + */ + public function getRequestBodyTemplate() + { + return $this->container['request_body_template']; + } + + /** + * Sets request_body_template + * + * @param string|null $request_body_template Request body template for HTTP request that will be sent for the webhook. Use Moustache style template variables to insert values from the original event payload. + * + * @return self + */ + public function setRequestBodyTemplate($request_body_template) + { + + if (is_null($request_body_template)) { + array_push($this->openAPINullablesSetToNull, 'request_body_template'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('request_body_template', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['request_body_template'] = $request_body_template; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url URL of your server that the webhook will be sent to. The schema of the JSON that is sent is described by the payloadJsonSchema. + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets method + * + * @return string + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string $method HTTP method that your server endpoint must listen for + * + * @return self + */ + public function setMethod($method) + { + $allowedValues = $this->getMethodAllowableValues(); + if (!in_array($method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'method', must be one of '%s'", + $method, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets payload_json_schema + * + * @return string + */ + public function getPayloadJsonSchema() + { + return $this->container['payload_json_schema']; + } + + /** + * Sets payload_json_schema + * + * @param string $payload_json_schema Deprecated. Fetch JSON Schema for webhook using the getJsonSchemaForWebhookPayload method + * + * @return self + */ + public function setPayloadJsonSchema($payload_json_schema) + { + + if (is_null($payload_json_schema)) { + throw new \InvalidArgumentException('non-nullable payload_json_schema cannot be null'); + } + + $this->container['payload_json_schema'] = $payload_json_schema; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at When the webhook was created + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + array_push($this->openAPINullablesSetToNull, 'created_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('created_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name Webhook trigger event name + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + array_push($this->openAPINullablesSetToNull, 'event_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets request_headers + * + * @return \MailSlurp\Models\WebhookHeaders|null + */ + public function getRequestHeaders() + { + return $this->container['request_headers']; + } + + /** + * Sets request_headers + * + * @param \MailSlurp\Models\WebhookHeaders|null $request_headers request_headers + * + * @return self + */ + public function setRequestHeaders($request_headers) + { + + if (is_null($request_headers)) { + throw new \InvalidArgumentException('non-nullable request_headers cannot be null'); + } + + $this->container['request_headers'] = $request_headers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookEmailOpenedPayload.php b/lib/Models/WebhookEmailOpenedPayload.php new file mode 100644 index 00000000..568da85a --- /dev/null +++ b/lib/Models/WebhookEmailOpenedPayload.php @@ -0,0 +1,782 @@ + + */ +class WebhookEmailOpenedPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookEmailOpenedPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'inbox_id' => 'string', + 'pixel_id' => 'string', + 'sent_email_id' => 'string', + 'recipient' => 'string', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'inbox_id' => 'uuid', + 'pixel_id' => 'uuid', + 'sent_email_id' => 'uuid', + 'recipient' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'inbox_id' => false, + 'pixel_id' => false, + 'sent_email_id' => false, + 'recipient' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'inbox_id' => 'inboxId', + 'pixel_id' => 'pixelId', + 'sent_email_id' => 'sentEmailId', + 'recipient' => 'recipient', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'inbox_id' => 'setInboxId', + 'pixel_id' => 'setPixelId', + 'sent_email_id' => 'setSentEmailId', + 'recipient' => 'setRecipient', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'inbox_id' => 'getInboxId', + 'pixel_id' => 'getPixelId', + 'sent_email_id' => 'getSentEmailId', + 'recipient' => 'getRecipient', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('pixel_id', $data ?? [], null); + $this->setIfExists('sent_email_id', $data ?? [], null); + $this->setIfExists('recipient', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['pixel_id'] === null) { + $invalidProperties[] = "'pixel_id' can't be null"; + } + if ($this->container['sent_email_id'] === null) { + $invalidProperties[] = "'sent_email_id' can't be null"; + } + if ($this->container['recipient'] === null) { + $invalidProperties[] = "'recipient' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Id of the inbox + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets pixel_id + * + * @return string + */ + public function getPixelId() + { + return $this->container['pixel_id']; + } + + /** + * Sets pixel_id + * + * @param string $pixel_id ID of the tracking pixel + * + * @return self + */ + public function setPixelId($pixel_id) + { + + if (is_null($pixel_id)) { + throw new \InvalidArgumentException('non-nullable pixel_id cannot be null'); + } + + $this->container['pixel_id'] = $pixel_id; + + return $this; + } + + /** + * Gets sent_email_id + * + * @return string + */ + public function getSentEmailId() + { + return $this->container['sent_email_id']; + } + + /** + * Sets sent_email_id + * + * @param string $sent_email_id ID of sent email + * + * @return self + */ + public function setSentEmailId($sent_email_id) + { + + if (is_null($sent_email_id)) { + throw new \InvalidArgumentException('non-nullable sent_email_id cannot be null'); + } + + $this->container['sent_email_id'] = $sent_email_id; + + return $this; + } + + /** + * Gets recipient + * + * @return string + */ + public function getRecipient() + { + return $this->container['recipient']; + } + + /** + * Sets recipient + * + * @param string $recipient Email address for the recipient of the tracking pixel + * + * @return self + */ + public function setRecipient($recipient) + { + + if (is_null($recipient)) { + throw new \InvalidArgumentException('non-nullable recipient cannot be null'); + } + + $this->container['recipient'] = $recipient; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Date time of event creation + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookEmailReadPayload.php b/lib/Models/WebhookEmailReadPayload.php new file mode 100644 index 00000000..88fb64fa --- /dev/null +++ b/lib/Models/WebhookEmailReadPayload.php @@ -0,0 +1,743 @@ + + */ +class WebhookEmailReadPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookEmailReadPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'email_id' => 'string', + 'inbox_id' => 'string', + 'email_is_read' => 'bool', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'email_id' => 'uuid', + 'inbox_id' => 'uuid', + 'email_is_read' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'email_id' => false, + 'inbox_id' => false, + 'email_is_read' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'email_id' => 'emailId', + 'inbox_id' => 'inboxId', + 'email_is_read' => 'emailIsRead', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'email_id' => 'setEmailId', + 'inbox_id' => 'setInboxId', + 'email_is_read' => 'setEmailIsRead', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'email_id' => 'getEmailId', + 'inbox_id' => 'getInboxId', + 'email_is_read' => 'getEmailIsRead', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('email_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('email_is_read', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['email_id'] === null) { + $invalidProperties[] = "'email_id' can't be null"; + } + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['email_is_read'] === null) { + $invalidProperties[] = "'email_is_read' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets email_id + * + * @return string + */ + public function getEmailId() + { + return $this->container['email_id']; + } + + /** + * Sets email_id + * + * @param string $email_id ID of the email that was received. Use this ID for fetching the email with the `EmailController`. + * + * @return self + */ + public function setEmailId($email_id) + { + + if (is_null($email_id)) { + throw new \InvalidArgumentException('non-nullable email_id cannot be null'); + } + + $this->container['email_id'] = $email_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Id of the inbox + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets email_is_read + * + * @return bool + */ + public function getEmailIsRead() + { + return $this->container['email_is_read']; + } + + /** + * Sets email_is_read + * + * @param bool $email_is_read Is the email read + * + * @return self + */ + public function setEmailIsRead($email_is_read) + { + + if (is_null($email_is_read)) { + throw new \InvalidArgumentException('non-nullable email_is_read cannot be null'); + } + + $this->container['email_is_read'] = $email_is_read; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Date time of event creation + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookHeaderNameValue.php b/lib/Models/WebhookHeaderNameValue.php new file mode 100644 index 00000000..ac0613c3 --- /dev/null +++ b/lib/Models/WebhookHeaderNameValue.php @@ -0,0 +1,455 @@ + + */ +class WebhookHeaderNameValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookHeaderNameValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of header + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value Value of header + * + * @return self + */ + public function setValue($value) + { + + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookHeaders.php b/lib/Models/WebhookHeaders.php new file mode 100644 index 00000000..626babc0 --- /dev/null +++ b/lib/Models/WebhookHeaders.php @@ -0,0 +1,416 @@ + + */ +class WebhookHeaders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookHeaders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'headers' => '\MailSlurp\Models\WebhookHeaderNameValue[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'headers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'headers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'headers' => 'headers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'headers' => 'setHeaders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'headers' => 'getHeaders' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('headers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['headers'] === null) { + $invalidProperties[] = "'headers' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets headers + * + * @return \MailSlurp\Models\WebhookHeaderNameValue[] + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param \MailSlurp\Models\WebhookHeaderNameValue[] $headers List of header name value pairs to include with webhook requests + * + * @return self + */ + public function setHeaders($headers) + { + + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + + $this->container['headers'] = $headers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookNewAttachmentPayload.php b/lib/Models/WebhookNewAttachmentPayload.php new file mode 100644 index 00000000..23bba9a5 --- /dev/null +++ b/lib/Models/WebhookNewAttachmentPayload.php @@ -0,0 +1,743 @@ + + */ +class WebhookNewAttachmentPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookNewAttachmentPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'webhook_name' => 'string', + 'event_name' => 'string', + 'attachment_id' => 'string', + 'name' => 'string', + 'content_type' => 'string', + 'content_length' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'webhook_name' => null, + 'event_name' => null, + 'attachment_id' => null, + 'name' => null, + 'content_type' => null, + 'content_length' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'webhook_name' => true, + 'event_name' => false, + 'attachment_id' => false, + 'name' => false, + 'content_type' => false, + 'content_length' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'webhook_name' => 'webhookName', + 'event_name' => 'eventName', + 'attachment_id' => 'attachmentId', + 'name' => 'name', + 'content_type' => 'contentType', + 'content_length' => 'contentLength' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'webhook_name' => 'setWebhookName', + 'event_name' => 'setEventName', + 'attachment_id' => 'setAttachmentId', + 'name' => 'setName', + 'content_type' => 'setContentType', + 'content_length' => 'setContentLength' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'webhook_name' => 'getWebhookName', + 'event_name' => 'getEventName', + 'attachment_id' => 'getAttachmentId', + 'name' => 'getName', + 'content_type' => 'getContentType', + 'content_length' => 'getContentLength' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('content_length', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['attachment_id'] === null) { + $invalidProperties[] = "'attachment_id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['content_type'] === null) { + $invalidProperties[] = "'content_type' can't be null"; + } + if ($this->container['content_length'] === null) { + $invalidProperties[] = "'content_length' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets attachment_id + * + * @return string + */ + public function getAttachmentId() + { + return $this->container['attachment_id']; + } + + /** + * Sets attachment_id + * + * @param string $attachment_id ID of attachment. Use the `AttachmentController` to + * + * @return self + */ + public function setAttachmentId($attachment_id) + { + + if (is_null($attachment_id)) { + throw new \InvalidArgumentException('non-nullable attachment_id cannot be null'); + } + + $this->container['attachment_id'] = $attachment_id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Filename of the attachment if present + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets content_type + * + * @return string + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string $content_type Content type of attachment such as 'image/png' or 'application/pdf + * + * @return self + */ + public function setContentType($content_type) + { + + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets content_length + * + * @return int + */ + public function getContentLength() + { + return $this->container['content_length']; + } + + /** + * Sets content_length + * + * @param int $content_length Size of attachment in bytes + * + * @return self + */ + public function setContentLength($content_length) + { + + if (is_null($content_length)) { + throw new \InvalidArgumentException('non-nullable content_length cannot be null'); + } + + $this->container['content_length'] = $content_length; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookNewContactPayload.php b/lib/Models/WebhookNewContactPayload.php new file mode 100644 index 00000000..30b18038 --- /dev/null +++ b/lib/Models/WebhookNewContactPayload.php @@ -0,0 +1,1040 @@ + + */ +class WebhookNewContactPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookNewContactPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'webhook_name' => 'string', + 'event_name' => 'string', + 'contact_id' => 'string', + 'group_id' => 'string', + 'first_name' => 'string', + 'last_name' => 'string', + 'company' => 'string', + 'primary_email_address' => 'string', + 'email_addresses' => 'string[]', + 'tags' => 'string[]', + 'meta_data' => 'object', + 'opt_out' => 'bool', + 'created_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'webhook_name' => null, + 'event_name' => null, + 'contact_id' => 'uuid', + 'group_id' => 'uuid', + 'first_name' => null, + 'last_name' => null, + 'company' => null, + 'primary_email_address' => null, + 'email_addresses' => null, + 'tags' => null, + 'meta_data' => null, + 'opt_out' => null, + 'created_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'webhook_name' => true, + 'event_name' => false, + 'contact_id' => false, + 'group_id' => true, + 'first_name' => true, + 'last_name' => true, + 'company' => true, + 'primary_email_address' => true, + 'email_addresses' => false, + 'tags' => false, + 'meta_data' => true, + 'opt_out' => false, + 'created_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'webhook_name' => 'webhookName', + 'event_name' => 'eventName', + 'contact_id' => 'contactId', + 'group_id' => 'groupId', + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'company' => 'company', + 'primary_email_address' => 'primaryEmailAddress', + 'email_addresses' => 'emailAddresses', + 'tags' => 'tags', + 'meta_data' => 'metaData', + 'opt_out' => 'optOut', + 'created_at' => 'createdAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'webhook_name' => 'setWebhookName', + 'event_name' => 'setEventName', + 'contact_id' => 'setContactId', + 'group_id' => 'setGroupId', + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'company' => 'setCompany', + 'primary_email_address' => 'setPrimaryEmailAddress', + 'email_addresses' => 'setEmailAddresses', + 'tags' => 'setTags', + 'meta_data' => 'setMetaData', + 'opt_out' => 'setOptOut', + 'created_at' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'webhook_name' => 'getWebhookName', + 'event_name' => 'getEventName', + 'contact_id' => 'getContactId', + 'group_id' => 'getGroupId', + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'company' => 'getCompany', + 'primary_email_address' => 'getPrimaryEmailAddress', + 'email_addresses' => 'getEmailAddresses', + 'tags' => 'getTags', + 'meta_data' => 'getMetaData', + 'opt_out' => 'getOptOut', + 'created_at' => 'getCreatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('contact_id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('primary_email_address', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('meta_data', $data ?? [], null); + $this->setIfExists('opt_out', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['contact_id'] === null) { + $invalidProperties[] = "'contact_id' can't be null"; + } + if ($this->container['email_addresses'] === null) { + $invalidProperties[] = "'email_addresses' can't be null"; + } + if ($this->container['tags'] === null) { + $invalidProperties[] = "'tags' can't be null"; + } + if ($this->container['opt_out'] === null) { + $invalidProperties[] = "'opt_out' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets contact_id + * + * @return string + */ + public function getContactId() + { + return $this->container['contact_id']; + } + + /** + * Sets contact_id + * + * @param string $contact_id Contact ID + * + * @return self + */ + public function setContactId($contact_id) + { + + if (is_null($contact_id)) { + throw new \InvalidArgumentException('non-nullable contact_id cannot be null'); + } + + $this->container['contact_id'] = $contact_id; + + return $this; + } + + /** + * Gets group_id + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['group_id']; + } + + /** + * Sets group_id + * + * @param string|null $group_id Contact group ID + * + * @return self + */ + public function setGroupId($group_id) + { + + if (is_null($group_id)) { + array_push($this->openAPINullablesSetToNull, 'group_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['group_id'] = $group_id; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name Contact first name + * + * @return self + */ + public function setFirstName($first_name) + { + + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name Contact last name + * + * @return self + */ + public function setLastName($last_name) + { + + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company Contact company name + * + * @return self + */ + public function setCompany($company) + { + + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets primary_email_address + * + * @return string|null + */ + public function getPrimaryEmailAddress() + { + return $this->container['primary_email_address']; + } + + /** + * Sets primary_email_address + * + * @param string|null $primary_email_address Primary email address for contact + * + * @return self + */ + public function setPrimaryEmailAddress($primary_email_address) + { + + if (is_null($primary_email_address)) { + array_push($this->openAPINullablesSetToNull, 'primary_email_address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('primary_email_address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['primary_email_address'] = $primary_email_address; + + return $this; + } + + /** + * Gets email_addresses + * + * @return string[] + */ + public function getEmailAddresses() + { + return $this->container['email_addresses']; + } + + /** + * Sets email_addresses + * + * @param string[] $email_addresses Email addresses for contact + * + * @return self + */ + public function setEmailAddresses($email_addresses) + { + + if (is_null($email_addresses)) { + throw new \InvalidArgumentException('non-nullable email_addresses cannot be null'); + } + + $this->container['email_addresses'] = $email_addresses; + + return $this; + } + + /** + * Gets tags + * + * @return string[] + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[] $tags Tags for contact + * + * @return self + */ + public function setTags($tags) + { + + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets meta_data + * + * @return object|null + */ + public function getMetaData() + { + return $this->container['meta_data']; + } + + /** + * Sets meta_data + * + * @param object|null $meta_data meta_data + * + * @return self + */ + public function setMetaData($meta_data) + { + + if (is_null($meta_data)) { + array_push($this->openAPINullablesSetToNull, 'meta_data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('meta_data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['meta_data'] = $meta_data; + + return $this; + } + + /** + * Gets opt_out + * + * @return bool + */ + public function getOptOut() + { + return $this->container['opt_out']; + } + + /** + * Sets opt_out + * + * @param bool $opt_out Has contact opted out of emails + * + * @return self + */ + public function setOptOut($opt_out) + { + + if (is_null($opt_out)) { + throw new \InvalidArgumentException('non-nullable opt_out cannot be null'); + } + + $this->container['opt_out'] = $opt_out; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Date time of event creation + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookNewEmailPayload.php b/lib/Models/WebhookNewEmailPayload.php new file mode 100644 index 00000000..eb4ffd34 --- /dev/null +++ b/lib/Models/WebhookNewEmailPayload.php @@ -0,0 +1,985 @@ + + */ +class WebhookNewEmailPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookNewEmailPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'inbox_id' => 'string', + 'domain_id' => 'string', + 'email_id' => 'string', + 'created_at' => '\DateTime', + 'to' => 'string[]', + 'from' => 'string', + 'cc' => 'string[]', + 'bcc' => 'string[]', + 'subject' => 'string', + 'attachment_meta_datas' => '\MailSlurp\Models\AttachmentMetaData[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'inbox_id' => 'uuid', + 'domain_id' => 'uuid', + 'email_id' => 'uuid', + 'created_at' => 'date-time', + 'to' => null, + 'from' => null, + 'cc' => null, + 'bcc' => null, + 'subject' => null, + 'attachment_meta_datas' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'inbox_id' => false, + 'domain_id' => true, + 'email_id' => false, + 'created_at' => false, + 'to' => false, + 'from' => false, + 'cc' => false, + 'bcc' => false, + 'subject' => true, + 'attachment_meta_datas' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'inbox_id' => 'inboxId', + 'domain_id' => 'domainId', + 'email_id' => 'emailId', + 'created_at' => 'createdAt', + 'to' => 'to', + 'from' => 'from', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'subject' => 'subject', + 'attachment_meta_datas' => 'attachmentMetaDatas' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'inbox_id' => 'setInboxId', + 'domain_id' => 'setDomainId', + 'email_id' => 'setEmailId', + 'created_at' => 'setCreatedAt', + 'to' => 'setTo', + 'from' => 'setFrom', + 'cc' => 'setCc', + 'bcc' => 'setBcc', + 'subject' => 'setSubject', + 'attachment_meta_datas' => 'setAttachmentMetaDatas' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'inbox_id' => 'getInboxId', + 'domain_id' => 'getDomainId', + 'email_id' => 'getEmailId', + 'created_at' => 'getCreatedAt', + 'to' => 'getTo', + 'from' => 'getFrom', + 'cc' => 'getCc', + 'bcc' => 'getBcc', + 'subject' => 'getSubject', + 'attachment_meta_datas' => 'getAttachmentMetaDatas' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('domain_id', $data ?? [], null); + $this->setIfExists('email_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); + $this->setIfExists('bcc', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('attachment_meta_datas', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['inbox_id'] === null) { + $invalidProperties[] = "'inbox_id' can't be null"; + } + if ($this->container['email_id'] === null) { + $invalidProperties[] = "'email_id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['cc'] === null) { + $invalidProperties[] = "'cc' can't be null"; + } + if ($this->container['bcc'] === null) { + $invalidProperties[] = "'bcc' can't be null"; + } + if ($this->container['attachment_meta_datas'] === null) { + $invalidProperties[] = "'attachment_meta_datas' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string $inbox_id Id of the inbox + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets domain_id + * + * @return string|null + */ + public function getDomainId() + { + return $this->container['domain_id']; + } + + /** + * Sets domain_id + * + * @param string|null $domain_id Id of the domain that received an email + * + * @return self + */ + public function setDomainId($domain_id) + { + + if (is_null($domain_id)) { + array_push($this->openAPINullablesSetToNull, 'domain_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('domain_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['domain_id'] = $domain_id; + + return $this; + } + + /** + * Gets email_id + * + * @return string + */ + public function getEmailId() + { + return $this->container['email_id']; + } + + /** + * Sets email_id + * + * @param string $email_id ID of the email that was received. Use this ID for fetching the email with the `EmailController`. + * + * @return self + */ + public function setEmailId($email_id) + { + + if (is_null($email_id)) { + throw new \InvalidArgumentException('non-nullable email_id cannot be null'); + } + + $this->container['email_id'] = $email_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at Date time of event creation + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setTo($to) + { + + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from Who the email was sent from. An email address - see fromName for the sender name. + * + * @return self + */ + public function setFrom($from) + { + + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets cc + * + * @return string[] + */ + public function getCc() + { + return $this->container['cc']; + } + + /** + * Sets cc + * + * @param string[] $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setCc($cc) + { + + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); + } + + $this->container['cc'] = $cc; + + return $this; + } + + /** + * Gets bcc + * + * @return string[] + */ + public function getBcc() + { + return $this->container['bcc']; + } + + /** + * Sets bcc + * + * @param string[] $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names. + * + * @return self + */ + public function setBcc($bcc) + { + + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + } + + $this->container['bcc'] = $bcc; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject The subject line of the email message as specified by SMTP subject header + * + * @return self + */ + public function setSubject($subject) + { + + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets attachment_meta_datas + * + * @return \MailSlurp\Models\AttachmentMetaData[] + */ + public function getAttachmentMetaDatas() + { + return $this->container['attachment_meta_datas']; + } + + /** + * Sets attachment_meta_datas + * + * @param \MailSlurp\Models\AttachmentMetaData[] $attachment_meta_datas List of attachment meta data objects if attachments present + * + * @return self + */ + public function setAttachmentMetaDatas($attachment_meta_datas) + { + + if (is_null($attachment_meta_datas)) { + throw new \InvalidArgumentException('non-nullable attachment_meta_datas cannot be null'); + } + + $this->container['attachment_meta_datas'] = $attachment_meta_datas; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookNewSmsPayload.php b/lib/Models/WebhookNewSmsPayload.php new file mode 100644 index 00000000..55499d8d --- /dev/null +++ b/lib/Models/WebhookNewSmsPayload.php @@ -0,0 +1,860 @@ + + */ +class WebhookNewSmsPayload implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookNewSmsPayload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message_id' => 'string', + 'webhook_id' => 'string', + 'event_name' => 'string', + 'webhook_name' => 'string', + 'sms_id' => 'string', + 'user_id' => 'string', + 'phone_number' => 'string', + 'to_number' => 'string', + 'from_number' => 'string', + 'body' => 'string', + 'read' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message_id' => null, + 'webhook_id' => 'uuid', + 'event_name' => null, + 'webhook_name' => null, + 'sms_id' => 'uuid', + 'user_id' => 'uuid', + 'phone_number' => 'uuid', + 'to_number' => null, + 'from_number' => null, + 'body' => null, + 'read' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'webhook_id' => false, + 'event_name' => false, + 'webhook_name' => true, + 'sms_id' => false, + 'user_id' => false, + 'phone_number' => false, + 'to_number' => false, + 'from_number' => false, + 'body' => false, + 'read' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message_id' => 'messageId', + 'webhook_id' => 'webhookId', + 'event_name' => 'eventName', + 'webhook_name' => 'webhookName', + 'sms_id' => 'smsId', + 'user_id' => 'userId', + 'phone_number' => 'phoneNumber', + 'to_number' => 'toNumber', + 'from_number' => 'fromNumber', + 'body' => 'body', + 'read' => 'read' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message_id' => 'setMessageId', + 'webhook_id' => 'setWebhookId', + 'event_name' => 'setEventName', + 'webhook_name' => 'setWebhookName', + 'sms_id' => 'setSmsId', + 'user_id' => 'setUserId', + 'phone_number' => 'setPhoneNumber', + 'to_number' => 'setToNumber', + 'from_number' => 'setFromNumber', + 'body' => 'setBody', + 'read' => 'setRead' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message_id' => 'getMessageId', + 'webhook_id' => 'getWebhookId', + 'event_name' => 'getEventName', + 'webhook_name' => 'getWebhookName', + 'sms_id' => 'getSmsId', + 'user_id' => 'getUserId', + 'phone_number' => 'getPhoneNumber', + 'to_number' => 'getToNumber', + 'from_number' => 'getFromNumber', + 'body' => 'getBody', + 'read' => 'getRead' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('webhook_name', $data ?? [], null); + $this->setIfExists('sms_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('to_number', $data ?? [], null); + $this->setIfExists('from_number', $data ?? [], null); + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['sms_id'] === null) { + $invalidProperties[] = "'sms_id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ($this->container['to_number'] === null) { + $invalidProperties[] = "'to_number' can't be null"; + } + if ($this->container['from_number'] === null) { + $invalidProperties[] = "'from_number' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; + } + if ($this->container['read'] === null) { + $invalidProperties[] = "'read' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication. + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id ID of webhook entity being triggered + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name Name of the event type webhook is being triggered for. + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets webhook_name + * + * @return string|null + */ + public function getWebhookName() + { + return $this->container['webhook_name']; + } + + /** + * Sets webhook_name + * + * @param string|null $webhook_name Name of the webhook being triggered + * + * @return self + */ + public function setWebhookName($webhook_name) + { + + if (is_null($webhook_name)) { + array_push($this->openAPINullablesSetToNull, 'webhook_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('webhook_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['webhook_name'] = $webhook_name; + + return $this; + } + + /** + * Gets sms_id + * + * @return string + */ + public function getSmsId() + { + return $this->container['sms_id']; + } + + /** + * Sets sms_id + * + * @param string $sms_id ID of SMS message + * + * @return self + */ + public function setSmsId($sms_id) + { + + if (is_null($sms_id)) { + throw new \InvalidArgumentException('non-nullable sms_id cannot be null'); + } + + $this->container['sms_id'] = $sms_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id User ID of event + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number ID of phone number receiving SMS + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + + if (is_null($phone_number)) { + throw new \InvalidArgumentException('non-nullable phone_number cannot be null'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets to_number + * + * @return string + */ + public function getToNumber() + { + return $this->container['to_number']; + } + + /** + * Sets to_number + * + * @param string $to_number Recipient phone number + * + * @return self + */ + public function setToNumber($to_number) + { + + if (is_null($to_number)) { + throw new \InvalidArgumentException('non-nullable to_number cannot be null'); + } + + $this->container['to_number'] = $to_number; + + return $this; + } + + /** + * Gets from_number + * + * @return string + */ + public function getFromNumber() + { + return $this->container['from_number']; + } + + /** + * Sets from_number + * + * @param string $from_number Sender phone number + * + * @return self + */ + public function setFromNumber($from_number) + { + + if (is_null($from_number)) { + throw new \InvalidArgumentException('non-nullable from_number cannot be null'); + } + + $this->container['from_number'] = $from_number; + + return $this; + } + + /** + * Gets body + * + * @return string + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string $body SMS message body + * + * @return self + */ + public function setBody($body) + { + + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets read + * + * @return bool + */ + public function getRead() + { + return $this->container['read']; + } + + /** + * Sets read + * + * @param bool $read SMS has been read + * + * @return self + */ + public function setRead($read) + { + + if (is_null($read)) { + throw new \InvalidArgumentException('non-nullable read cannot be null'); + } + + $this->container['read'] = $read; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookProjection.php b/lib/Models/WebhookProjection.php new file mode 100644 index 00000000..d49b07e6 --- /dev/null +++ b/lib/Models/WebhookProjection.php @@ -0,0 +1,727 @@ + + */ +class WebhookProjection implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookProjection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string', + 'url' => 'string', + 'inbox_id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'event_name' => 'string', + 'phone_number_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => 'uuid', + 'url' => null, + 'inbox_id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'event_name' => null, + 'phone_number_id' => 'uuid' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false, + 'url' => false, + 'inbox_id' => false, + 'created_at' => false, + 'updated_at' => false, + 'event_name' => false, + 'phone_number_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id', + 'url' => 'url', + 'inbox_id' => 'inboxId', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'event_name' => 'eventName', + 'phone_number_id' => 'phoneNumberId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId', + 'url' => 'setUrl', + 'inbox_id' => 'setInboxId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'event_name' => 'setEventName', + 'phone_number_id' => 'setPhoneNumberId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId', + 'url' => 'getUrl', + 'inbox_id' => 'getInboxId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'event_name' => 'getEventName', + 'phone_number_id' => 'getPhoneNumberId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL'; + public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT'; + public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED'; + public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ'; + public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const EVENT_NAME_BOUNCE = 'BOUNCE'; + public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const EVENT_NAME_NEW_SMS = 'NEW_SMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventNameAllowableValues() + { + return [ + self::EVENT_NAME_EMAIL_RECEIVED, + self::EVENT_NAME_NEW_EMAIL, + self::EVENT_NAME_NEW_CONTACT, + self::EVENT_NAME_NEW_ATTACHMENT, + self::EVENT_NAME_EMAIL_OPENED, + self::EVENT_NAME_EMAIL_READ, + self::EVENT_NAME_DELIVERY_STATUS, + self::EVENT_NAME_BOUNCE, + self::EVENT_NAME_BOUNCE_RECIPIENT, + self::EVENT_NAME_NEW_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('phone_number_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'event_name', must be one of '%s'", + $this->container['event_name'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url url + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + throw new \InvalidArgumentException('non-nullable inbox_id cannot be null'); + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + $allowedValues = $this->getEventNameAllowableValues(); + if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'event_name', must be one of '%s'", + $event_name, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets phone_number_id + * + * @return string|null + */ + public function getPhoneNumberId() + { + return $this->container['phone_number_id']; + } + + /** + * Sets phone_number_id + * + * @param string|null $phone_number_id phone_number_id + * + * @return self + */ + public function setPhoneNumberId($phone_number_id) + { + + if (is_null($phone_number_id)) { + throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null'); + } + + $this->container['phone_number_id'] = $phone_number_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookRedriveResult.php b/lib/Models/WebhookRedriveResult.php new file mode 100644 index 00000000..1d220362 --- /dev/null +++ b/lib/Models/WebhookRedriveResult.php @@ -0,0 +1,498 @@ + + */ +class WebhookRedriveResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookRedriveResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'webhook_result_id' => 'string', + 'success' => 'bool', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'webhook_result_id' => 'uuid', + 'success' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'webhook_result_id' => false, + 'success' => false, + 'message' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'webhook_result_id' => 'webhookResultId', + 'success' => 'success', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'webhook_result_id' => 'setWebhookResultId', + 'success' => 'setSuccess', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'webhook_result_id' => 'getWebhookResultId', + 'success' => 'getSuccess', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('webhook_result_id', $data ?? [], null); + $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['webhook_result_id'] === null) { + $invalidProperties[] = "'webhook_result_id' can't be null"; + } + if ($this->container['success'] === null) { + $invalidProperties[] = "'success' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets webhook_result_id + * + * @return string + */ + public function getWebhookResultId() + { + return $this->container['webhook_result_id']; + } + + /** + * Sets webhook_result_id + * + * @param string $webhook_result_id webhook_result_id + * + * @return self + */ + public function setWebhookResultId($webhook_result_id) + { + + if (is_null($webhook_result_id)) { + throw new \InvalidArgumentException('non-nullable webhook_result_id cannot be null'); + } + + $this->container['webhook_result_id'] = $webhook_result_id; + + return $this; + } + + /** + * Gets success + * + * @return bool + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool $success success + * + * @return self + */ + public function setSuccess($success) + { + + if (is_null($success)) { + throw new \InvalidArgumentException('non-nullable success cannot be null'); + } + + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookResultDto.php b/lib/Models/WebhookResultDto.php new file mode 100644 index 00000000..c47e1e23 --- /dev/null +++ b/lib/Models/WebhookResultDto.php @@ -0,0 +1,1157 @@ + + */ +class WebhookResultDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookResultDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'user_id' => 'string', + 'inbox_id' => 'string', + 'webhook_id' => 'string', + 'webhook_url' => 'string', + 'message_id' => 'string', + 'redrive_id' => 'string', + 'http_method' => 'string', + 'webhook_event' => 'string', + 'response_status' => 'int', + 'response_time_millis' => 'int', + 'response_body_extract' => 'string', + 'result_type' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'seen' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'uuid', + 'user_id' => 'uuid', + 'inbox_id' => 'uuid', + 'webhook_id' => 'uuid', + 'webhook_url' => null, + 'message_id' => null, + 'redrive_id' => 'uuid', + 'http_method' => null, + 'webhook_event' => null, + 'response_status' => 'int32', + 'response_time_millis' => 'int64', + 'response_body_extract' => null, + 'result_type' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'seen' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'user_id' => false, + 'inbox_id' => true, + 'webhook_id' => false, + 'webhook_url' => false, + 'message_id' => false, + 'redrive_id' => true, + 'http_method' => false, + 'webhook_event' => false, + 'response_status' => true, + 'response_time_millis' => false, + 'response_body_extract' => true, + 'result_type' => true, + 'created_at' => false, + 'updated_at' => false, + 'seen' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user_id' => 'userId', + 'inbox_id' => 'inboxId', + 'webhook_id' => 'webhookId', + 'webhook_url' => 'webhookUrl', + 'message_id' => 'messageId', + 'redrive_id' => 'redriveId', + 'http_method' => 'httpMethod', + 'webhook_event' => 'webhookEvent', + 'response_status' => 'responseStatus', + 'response_time_millis' => 'responseTimeMillis', + 'response_body_extract' => 'responseBodyExtract', + 'result_type' => 'resultType', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'seen' => 'seen' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user_id' => 'setUserId', + 'inbox_id' => 'setInboxId', + 'webhook_id' => 'setWebhookId', + 'webhook_url' => 'setWebhookUrl', + 'message_id' => 'setMessageId', + 'redrive_id' => 'setRedriveId', + 'http_method' => 'setHttpMethod', + 'webhook_event' => 'setWebhookEvent', + 'response_status' => 'setResponseStatus', + 'response_time_millis' => 'setResponseTimeMillis', + 'response_body_extract' => 'setResponseBodyExtract', + 'result_type' => 'setResultType', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'seen' => 'setSeen' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user_id' => 'getUserId', + 'inbox_id' => 'getInboxId', + 'webhook_id' => 'getWebhookId', + 'webhook_url' => 'getWebhookUrl', + 'message_id' => 'getMessageId', + 'redrive_id' => 'getRedriveId', + 'http_method' => 'getHttpMethod', + 'webhook_event' => 'getWebhookEvent', + 'response_status' => 'getResponseStatus', + 'response_time_millis' => 'getResponseTimeMillis', + 'response_body_extract' => 'getResponseBodyExtract', + 'result_type' => 'getResultType', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'seen' => 'getSeen' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const HTTP_METHOD_GET = 'GET'; + public const HTTP_METHOD_HEAD = 'HEAD'; + public const HTTP_METHOD_POST = 'POST'; + public const HTTP_METHOD_PUT = 'PUT'; + public const HTTP_METHOD_PATCH = 'PATCH'; + public const HTTP_METHOD_DELETE = 'DELETE'; + public const HTTP_METHOD_OPTIONS = 'OPTIONS'; + public const HTTP_METHOD_TRACE = 'TRACE'; + public const WEBHOOK_EVENT_EMAIL_RECEIVED = 'EMAIL_RECEIVED'; + public const WEBHOOK_EVENT_NEW_EMAIL = 'NEW_EMAIL'; + public const WEBHOOK_EVENT_NEW_CONTACT = 'NEW_CONTACT'; + public const WEBHOOK_EVENT_NEW_ATTACHMENT = 'NEW_ATTACHMENT'; + public const WEBHOOK_EVENT_EMAIL_OPENED = 'EMAIL_OPENED'; + public const WEBHOOK_EVENT_EMAIL_READ = 'EMAIL_READ'; + public const WEBHOOK_EVENT_DELIVERY_STATUS = 'DELIVERY_STATUS'; + public const WEBHOOK_EVENT_BOUNCE = 'BOUNCE'; + public const WEBHOOK_EVENT_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT'; + public const WEBHOOK_EVENT_NEW_SMS = 'NEW_SMS'; + public const RESULT_TYPE_BAD_RESPONSE = 'BAD_RESPONSE'; + public const RESULT_TYPE_EXCEPTION = 'EXCEPTION'; + public const RESULT_TYPE_SUCCESS = 'SUCCESS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpMethodAllowableValues() + { + return [ + self::HTTP_METHOD_GET, + self::HTTP_METHOD_HEAD, + self::HTTP_METHOD_POST, + self::HTTP_METHOD_PUT, + self::HTTP_METHOD_PATCH, + self::HTTP_METHOD_DELETE, + self::HTTP_METHOD_OPTIONS, + self::HTTP_METHOD_TRACE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getWebhookEventAllowableValues() + { + return [ + self::WEBHOOK_EVENT_EMAIL_RECEIVED, + self::WEBHOOK_EVENT_NEW_EMAIL, + self::WEBHOOK_EVENT_NEW_CONTACT, + self::WEBHOOK_EVENT_NEW_ATTACHMENT, + self::WEBHOOK_EVENT_EMAIL_OPENED, + self::WEBHOOK_EVENT_EMAIL_READ, + self::WEBHOOK_EVENT_DELIVERY_STATUS, + self::WEBHOOK_EVENT_BOUNCE, + self::WEBHOOK_EVENT_BOUNCE_RECIPIENT, + self::WEBHOOK_EVENT_NEW_SMS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultTypeAllowableValues() + { + return [ + self::RESULT_TYPE_BAD_RESPONSE, + self::RESULT_TYPE_EXCEPTION, + self::RESULT_TYPE_SUCCESS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('inbox_id', $data ?? [], null); + $this->setIfExists('webhook_id', $data ?? [], null); + $this->setIfExists('webhook_url', $data ?? [], null); + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('redrive_id', $data ?? [], null); + $this->setIfExists('http_method', $data ?? [], null); + $this->setIfExists('webhook_event', $data ?? [], null); + $this->setIfExists('response_status', $data ?? [], null); + $this->setIfExists('response_time_millis', $data ?? [], null); + $this->setIfExists('response_body_extract', $data ?? [], null); + $this->setIfExists('result_type', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('seen', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['webhook_id'] === null) { + $invalidProperties[] = "'webhook_id' can't be null"; + } + if ($this->container['webhook_url'] === null) { + $invalidProperties[] = "'webhook_url' can't be null"; + } + if ($this->container['message_id'] === null) { + $invalidProperties[] = "'message_id' can't be null"; + } + if ($this->container['http_method'] === null) { + $invalidProperties[] = "'http_method' can't be null"; + } + $allowedValues = $this->getHttpMethodAllowableValues(); + if (!is_null($this->container['http_method']) && !in_array($this->container['http_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_method', must be one of '%s'", + $this->container['http_method'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['webhook_event'] === null) { + $invalidProperties[] = "'webhook_event' can't be null"; + } + $allowedValues = $this->getWebhookEventAllowableValues(); + if (!is_null($this->container['webhook_event']) && !in_array($this->container['webhook_event'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'webhook_event', must be one of '%s'", + $this->container['webhook_event'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['response_time_millis'] === null) { + $invalidProperties[] = "'response_time_millis' can't be null"; + } + $allowedValues = $this->getResultTypeAllowableValues(); + if (!is_null($this->container['result_type']) && !in_array($this->container['result_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result_type', must be one of '%s'", + $this->container['result_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + if ($this->container['seen'] === null) { + $invalidProperties[] = "'seen' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets inbox_id + * + * @return string|null + */ + public function getInboxId() + { + return $this->container['inbox_id']; + } + + /** + * Sets inbox_id + * + * @param string|null $inbox_id inbox_id + * + * @return self + */ + public function setInboxId($inbox_id) + { + + if (is_null($inbox_id)) { + array_push($this->openAPINullablesSetToNull, 'inbox_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inbox_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['inbox_id'] = $inbox_id; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string $webhook_id webhook_id + * + * @return self + */ + public function setWebhookId($webhook_id) + { + + if (is_null($webhook_id)) { + throw new \InvalidArgumentException('non-nullable webhook_id cannot be null'); + } + + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets webhook_url + * + * @return string + */ + public function getWebhookUrl() + { + return $this->container['webhook_url']; + } + + /** + * Sets webhook_url + * + * @param string $webhook_url webhook_url + * + * @return self + */ + public function setWebhookUrl($webhook_url) + { + + if (is_null($webhook_url)) { + throw new \InvalidArgumentException('non-nullable webhook_url cannot be null'); + } + + $this->container['webhook_url'] = $webhook_url; + + return $this; + } + + /** + * Gets message_id + * + * @return string + */ + public function getMessageId() + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string $message_id message_id + * + * @return self + */ + public function setMessageId($message_id) + { + + if (is_null($message_id)) { + throw new \InvalidArgumentException('non-nullable message_id cannot be null'); + } + + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets redrive_id + * + * @return string|null + */ + public function getRedriveId() + { + return $this->container['redrive_id']; + } + + /** + * Sets redrive_id + * + * @param string|null $redrive_id redrive_id + * + * @return self + */ + public function setRedriveId($redrive_id) + { + + if (is_null($redrive_id)) { + array_push($this->openAPINullablesSetToNull, 'redrive_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redrive_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['redrive_id'] = $redrive_id; + + return $this; + } + + /** + * Gets http_method + * + * @return string + */ + public function getHttpMethod() + { + return $this->container['http_method']; + } + + /** + * Sets http_method + * + * @param string $http_method http_method + * + * @return self + */ + public function setHttpMethod($http_method) + { + $allowedValues = $this->getHttpMethodAllowableValues(); + if (!in_array($http_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_method', must be one of '%s'", + $http_method, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($http_method)) { + throw new \InvalidArgumentException('non-nullable http_method cannot be null'); + } + + $this->container['http_method'] = $http_method; + + return $this; + } + + /** + * Gets webhook_event + * + * @return string + */ + public function getWebhookEvent() + { + return $this->container['webhook_event']; + } + + /** + * Sets webhook_event + * + * @param string $webhook_event webhook_event + * + * @return self + */ + public function setWebhookEvent($webhook_event) + { + $allowedValues = $this->getWebhookEventAllowableValues(); + if (!in_array($webhook_event, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'webhook_event', must be one of '%s'", + $webhook_event, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($webhook_event)) { + throw new \InvalidArgumentException('non-nullable webhook_event cannot be null'); + } + + $this->container['webhook_event'] = $webhook_event; + + return $this; + } + + /** + * Gets response_status + * + * @return int|null + */ + public function getResponseStatus() + { + return $this->container['response_status']; + } + + /** + * Sets response_status + * + * @param int|null $response_status response_status + * + * @return self + */ + public function setResponseStatus($response_status) + { + + if (is_null($response_status)) { + array_push($this->openAPINullablesSetToNull, 'response_status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('response_status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['response_status'] = $response_status; + + return $this; + } + + /** + * Gets response_time_millis + * + * @return int + */ + public function getResponseTimeMillis() + { + return $this->container['response_time_millis']; + } + + /** + * Sets response_time_millis + * + * @param int $response_time_millis response_time_millis + * + * @return self + */ + public function setResponseTimeMillis($response_time_millis) + { + + if (is_null($response_time_millis)) { + throw new \InvalidArgumentException('non-nullable response_time_millis cannot be null'); + } + + $this->container['response_time_millis'] = $response_time_millis; + + return $this; + } + + /** + * Gets response_body_extract + * + * @return string|null + */ + public function getResponseBodyExtract() + { + return $this->container['response_body_extract']; + } + + /** + * Sets response_body_extract + * + * @param string|null $response_body_extract response_body_extract + * + * @return self + */ + public function setResponseBodyExtract($response_body_extract) + { + + if (is_null($response_body_extract)) { + array_push($this->openAPINullablesSetToNull, 'response_body_extract'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('response_body_extract', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['response_body_extract'] = $response_body_extract; + + return $this; + } + + /** + * Gets result_type + * + * @return string|null + */ + public function getResultType() + { + return $this->container['result_type']; + } + + /** + * Sets result_type + * + * @param string|null $result_type result_type + * + * @return self + */ + public function setResultType($result_type) + { + $allowedValues = $this->getResultTypeAllowableValues(); + if (!is_null($result_type) && !in_array($result_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result_type', must be one of '%s'", + $result_type, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($result_type)) { + array_push($this->openAPINullablesSetToNull, 'result_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['result_type'] = $result_type; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets seen + * + * @return bool + */ + public function getSeen() + { + return $this->container['seen']; + } + + /** + * Sets seen + * + * @param bool $seen seen + * + * @return self + */ + public function setSeen($seen) + { + + if (is_null($seen)) { + throw new \InvalidArgumentException('non-nullable seen cannot be null'); + } + + $this->container['seen'] = $seen; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookTestRequest.php b/lib/Models/WebhookTestRequest.php new file mode 100644 index 00000000..70fe108c --- /dev/null +++ b/lib/Models/WebhookTestRequest.php @@ -0,0 +1,583 @@ + + */ +class WebhookTestRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookTestRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string', + 'method' => 'string', + 'headers' => 'array', + 'payload' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null, + 'method' => null, + 'headers' => null, + 'payload' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => false, + 'method' => false, + 'headers' => false, + 'payload' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'url' => 'url', + 'method' => 'method', + 'headers' => 'headers', + 'payload' => 'payload' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl', + 'method' => 'setMethod', + 'headers' => 'setHeaders', + 'payload' => 'setPayload' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl', + 'method' => 'getMethod', + 'headers' => 'getHeaders', + 'payload' => 'getPayload' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const METHOD_GET = 'GET'; + public const METHOD_HEAD = 'HEAD'; + public const METHOD_POST = 'POST'; + public const METHOD_PUT = 'PUT'; + public const METHOD_PATCH = 'PATCH'; + public const METHOD_DELETE = 'DELETE'; + public const METHOD_OPTIONS = 'OPTIONS'; + public const METHOD_TRACE = 'TRACE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMethodAllowableValues() + { + return [ + self::METHOD_GET, + self::METHOD_HEAD, + self::METHOD_POST, + self::METHOD_PUT, + self::METHOD_PATCH, + self::METHOD_DELETE, + self::METHOD_OPTIONS, + self::METHOD_TRACE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('payload', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['method'] === null) { + $invalidProperties[] = "'method' can't be null"; + } + $allowedValues = $this->getMethodAllowableValues(); + if (!is_null($this->container['method']) && !in_array($this->container['method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'method', must be one of '%s'", + $this->container['method'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['headers'] === null) { + $invalidProperties[] = "'headers' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url url + * + * @return self + */ + public function setUrl($url) + { + + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets method + * + * @return string + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string $method method + * + * @return self + */ + public function setMethod($method) + { + $allowedValues = $this->getMethodAllowableValues(); + if (!in_array($method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'method', must be one of '%s'", + $method, + implode("', '", $allowedValues) + ) + ); + } + + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets headers + * + * @return array + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets payload + * + * @return string|null + */ + public function getPayload() + { + return $this->container['payload']; + } + + /** + * Sets payload + * + * @param string|null $payload payload + * + * @return self + */ + public function setPayload($payload) + { + + if (is_null($payload)) { + array_push($this->openAPINullablesSetToNull, 'payload'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('payload', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['payload'] = $payload; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookTestResponse.php b/lib/Models/WebhookTestResponse.php new file mode 100644 index 00000000..36c42a3e --- /dev/null +++ b/lib/Models/WebhookTestResponse.php @@ -0,0 +1,463 @@ + + */ +class WebhookTestResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookTestResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status_code' => 'int', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status_code' => 'int32', + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status_code' => true, + 'message' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status_code' => 'statusCode', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status_code' => 'setStatusCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status_code' => 'getStatusCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status_code + * + * @return int|null + */ + public function getStatusCode() + { + return $this->container['status_code']; + } + + /** + * Sets status_code + * + * @param int|null $status_code status_code + * + * @return self + */ + public function setStatusCode($status_code) + { + + if (is_null($status_code)) { + array_push($this->openAPINullablesSetToNull, 'status_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['status_code'] = $status_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Models/WebhookTestResult.php b/lib/Models/WebhookTestResult.php new file mode 100644 index 00000000..e3256a09 --- /dev/null +++ b/lib/Models/WebhookTestResult.php @@ -0,0 +1,498 @@ + + */ +class WebhookTestResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebhookTestResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'response' => '\MailSlurp\Models\WebhookTestResponse', + 'request' => '\MailSlurp\Models\WebhookTestRequest' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'response' => null, + 'request' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true, + 'response' => false, + 'request' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'response' => 'response', + 'request' => 'request' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'response' => 'setResponse', + 'request' => 'setRequest' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'response' => 'getResponse', + 'request' => 'getRequest' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('response', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['response'] === null) { + $invalidProperties[] = "'response' can't be null"; + } + if ($this->container['request'] === null) { + $invalidProperties[] = "'request' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets response + * + * @return \MailSlurp\Models\WebhookTestResponse + */ + public function getResponse() + { + return $this->container['response']; + } + + /** + * Sets response + * + * @param \MailSlurp\Models\WebhookTestResponse $response response + * + * @return self + */ + public function setResponse($response) + { + + if (is_null($response)) { + throw new \InvalidArgumentException('non-nullable response cannot be null'); + } + + $this->container['response'] = $response; + + return $this; + } + + /** + * Gets request + * + * @return \MailSlurp\Models\WebhookTestRequest + */ + public function getRequest() + { + return $this->container['request']; + } + + /** + * Sets request + * + * @param \MailSlurp\Models\WebhookTestRequest $request request + * + * @return self + */ + public function setRequest($request) + { + + if (is_null($request)) { + throw new \InvalidArgumentException('non-nullable request cannot be null'); + } + + $this->container['request'] = $request; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 00000000..06361677 --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,523 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + if ( + empty($value) + && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty + ) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some API's return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\MailSlurp\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..442af8c4 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./lib/Apis + ./lib/Models + + + + + ./test/Api + ./test/Model + + + + + + diff --git a/test/Api/AliasControllerApiTest.php b/test/Api/AliasControllerApiTest.php new file mode 100644 index 00000000..305b4977 --- /dev/null +++ b/test/Api/AliasControllerApiTest.php @@ -0,0 +1,182 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAlias + * + * Delete an email alias. + * + */ + public function testDeleteAlias() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAlias + * + * Get an email alias. + * + */ + public function testGetAlias() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAliasEmails + * + * Get emails for an alias. + * + */ + public function testGetAliasEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAliasThreads + * + * Get threads created for an alias. + * + */ + public function testGetAliasThreads() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAliases + * + * Get all email aliases you have created. + * + */ + public function testGetAliases() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for replyToAliasEmail + * + * Reply to an email. + * + */ + public function testReplyToAliasEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendAliasEmail + * + * Send an email from an alias inbox. + * + */ + public function testSendAliasEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateAlias + * + * Update an email alias. + * + */ + public function testUpdateAlias() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/ApiUserControllerApiTest.php b/test/Api/ApiUserControllerApiTest.php new file mode 100644 index 00000000..84668057 --- /dev/null +++ b/test/Api/ApiUserControllerApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getUserInfo + * + * . + * + */ + public function testGetUserInfo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/AttachmentControllerApiTest.php b/test/Api/AttachmentControllerApiTest.php new file mode 100644 index 00000000..bc7f2bbd --- /dev/null +++ b/test/Api/AttachmentControllerApiTest.php @@ -0,0 +1,194 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAttachment + * + * Delete an attachment. + * + */ + public function testDeleteAttachment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadAttachmentAsBase64Encoded + * + * Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.. + * + */ + public function testDownloadAttachmentAsBase64Encoded() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadAttachmentAsBytes + * + * Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.. + * + */ + public function testDownloadAttachmentAsBytes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAttachment + * + * Get an attachment entity. + * + */ + public function testGetAttachment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAttachmentInfo + * + * Get email attachment metadata information. + * + */ + public function testGetAttachmentInfo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAttachments + * + * Get email attachments. + * + */ + public function testGetAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for uploadAttachment + * + * Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.. + * + */ + public function testUploadAttachment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for uploadAttachmentBytes + * + * Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.. + * + */ + public function testUploadAttachmentBytes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for uploadMultipartForm + * + * Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.. + * + */ + public function testUploadMultipartForm() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/BounceControllerApiTest.php b/test/Api/BounceControllerApiTest.php new file mode 100644 index 00000000..10c8969d --- /dev/null +++ b/test/Api/BounceControllerApiTest.php @@ -0,0 +1,158 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getBouncedEmail + * + * Get a bounced email.. + * + */ + public function testGetBouncedEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getBouncedEmails + * + * Get paginated list of bounced emails.. + * + */ + public function testGetBouncedEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getBouncedRecipient + * + * Get a bounced email.. + * + */ + public function testGetBouncedRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getBouncedRecipients + * + * Get paginated list of bounced recipients.. + * + */ + public function testGetBouncedRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getComplaints + * + * Get paginated list of complaints.. + * + */ + public function testGetComplaints() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getListUnsubscribeRecipients + * + * Get paginated list of unsubscribed recipients.. + * + */ + public function testGetListUnsubscribeRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/BulkActionsControllerApiTest.php b/test/Api/BulkActionsControllerApiTest.php new file mode 100644 index 00000000..4624e1dd --- /dev/null +++ b/test/Api/BulkActionsControllerApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for bulkDeleteInboxes + * + * Bulk Delete Inboxes. + * + */ + public function testBulkDeleteInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for bulkSendEmails + * + * Bulk Send Emails. + * + */ + public function testBulkSendEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/CommonActionsControllerApiTest.php b/test/Api/CommonActionsControllerApiTest.php new file mode 100644 index 00000000..a226d235 --- /dev/null +++ b/test/Api/CommonActionsControllerApiTest.php @@ -0,0 +1,134 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createRandomInbox + * + * Create new random inbox. + * + */ + public function testCreateRandomInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteEmailAddress + * + * Delete inbox email address by inbox id. + * + */ + public function testDeleteEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for emptyInbox + * + * Delete all emails in an inbox. + * + */ + public function testEmptyInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendEmailSimple + * + * Send an email. + * + */ + public function testSendEmailSimple() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/ContactControllerApiTest.php b/test/Api/ContactControllerApiTest.php new file mode 100644 index 00000000..4df5fbb9 --- /dev/null +++ b/test/Api/ContactControllerApiTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteContact + * + * Delete contact. + * + */ + public function testDeleteContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllContacts + * + * Get all contacts. + * + */ + public function testGetAllContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getContact + * + * Get contact. + * + */ + public function testGetContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getContactVCard + * + * Get contact vCard vcf file. + * + */ + public function testGetContactVCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getContacts + * + * Get all contacts. + * + */ + public function testGetContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/DomainControllerApiTest.php b/test/Api/DomainControllerApiTest.php new file mode 100644 index 00000000..b557367a --- /dev/null +++ b/test/Api/DomainControllerApiTest.php @@ -0,0 +1,158 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createDomain + * + * Create Domain. + * + */ + public function testCreateDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteDomain + * + * Delete a domain. + * + */ + public function testDeleteDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getDomain + * + * Get a domain. + * + */ + public function testGetDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getDomainWildcardCatchAllInbox + * + * Get catch all wild card inbox for domain. + * + */ + public function testGetDomainWildcardCatchAllInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getDomains + * + * Get domains. + * + */ + public function testGetDomains() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateDomain + * + * Update a domain. + * + */ + public function testUpdateDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/EmailControllerApiTest.php b/test/Api/EmailControllerApiTest.php new file mode 100644 index 00000000..81897538 --- /dev/null +++ b/test/Api/EmailControllerApiTest.php @@ -0,0 +1,446 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAllEmails + * + * Delete all emails in all inboxes.. + * + */ + public function testDeleteAllEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteEmail + * + * Delete an email. + * + */ + public function testDeleteEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadAttachment + * + * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string.. + * + */ + public function testDownloadAttachment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadAttachmentBase64 + * + * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`.. + * + */ + public function testDownloadAttachmentBase64() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadBody + * + * Get email body as string. Returned as `plain/text` with content type header.. + * + */ + public function testDownloadBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for downloadBodyBytes + * + * Get email body in bytes. Returned as `octet-stream` with content type header.. + * + */ + public function testDownloadBodyBytes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for forwardEmail + * + * Forward email to recipients. + * + */ + public function testForwardEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAttachmentMetaData + * + * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods.. + * + */ + public function testGetAttachmentMetaData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmail + * + * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.. + * + */ + public function testGetEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailAttachments + * + * Get all email attachment metadata. Metadata includes name and size of attachments.. + * + */ + public function testGetEmailAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailContentMatch + * + * Get email content regex pattern match results. Runs regex against email body and returns match groups.. + * + */ + public function testGetEmailContentMatch() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailCount + * + * Get email count. + * + */ + public function testGetEmailCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailHTML + * + * Get email content as HTML. For displaying emails in browser context.. + * + */ + public function testGetEmailHTML() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailHTMLJson + * + * Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content. + * + */ + public function testGetEmailHTMLJson() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailHTMLQuery + * + * Parse and return text from an email, stripping HTML and decoding encoded characters. + * + */ + public function testGetEmailHTMLQuery() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailLinks + * + * Parse and return list of links found in an email (only works for HTML content). + * + */ + public function testGetEmailLinks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailPreviewURLs + * + * Get email URLs for viewing in browser or downloading. + * + */ + public function testGetEmailPreviewURLs() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailTextLines + * + * Parse and return text from an email, stripping HTML and decoding encoded characters. + * + */ + public function testGetEmailTextLines() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmailsPaginated + * + * Get all emails in all inboxes in paginated form. Email API list all.. + * + */ + public function testGetEmailsPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getGravatarUrlForEmailAddress + * + * . + * + */ + public function testGetGravatarUrlForEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getLatestEmail + * + * Get latest email in all inboxes. Most recently received.. + * + */ + public function testGetLatestEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getLatestEmailInInbox1 + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.. + * + */ + public function testGetLatestEmailInInbox1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getOrganizationEmailsPaginated + * + * Get all organization emails. List team or shared test email accounts. + * + */ + public function testGetOrganizationEmailsPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getRawEmailContents + * + * Get raw email string. Returns unparsed raw SMTP message with headers and body.. + * + */ + public function testGetRawEmailContents() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getRawEmailJson + * + * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.. + * + */ + public function testGetRawEmailJson() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getUnreadEmailCount + * + * Get unread email count. + * + */ + public function testGetUnreadEmailCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for markAsRead + * + * Mark an email as read on unread. + * + */ + public function testMarkAsRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for replyToEmail + * + * Reply to an email. + * + */ + public function testReplyToEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendEmailSourceOptional + * + * Send email. + * + */ + public function testSendEmailSourceOptional() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for validateEmail + * + * Validate email HTML contents. + * + */ + public function testValidateEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/EmailVerificationControllerApiTest.php b/test/Api/EmailVerificationControllerApiTest.php new file mode 100644 index 00000000..ed1e8d88 --- /dev/null +++ b/test/Api/EmailVerificationControllerApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for validateEmailAddressList + * + * Validate a list of email addresses. Per unit billing. See your plan for pricing.. + * + */ + public function testValidateEmailAddressList() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/ExpiredControllerApiTest.php b/test/Api/ExpiredControllerApiTest.php new file mode 100644 index 00000000..9fbf827e --- /dev/null +++ b/test/Api/ExpiredControllerApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getExpiredInboxByInboxId + * + * Get expired inbox record for a previously existing inbox. + * + */ + public function testGetExpiredInboxByInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getExpiredInboxRecord + * + * Get an expired inbox record. + * + */ + public function testGetExpiredInboxRecord() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getExpiredInboxes + * + * List records of expired inboxes. + * + */ + public function testGetExpiredInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/ExportControllerApiTest.php b/test/Api/ExportControllerApiTest.php new file mode 100644 index 00000000..9fdfb79e --- /dev/null +++ b/test/Api/ExportControllerApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getExportLink + * + * Get export link. + * + */ + public function testGetExportLink() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/FormControllerApiTest.php b/test/Api/FormControllerApiTest.php new file mode 100644 index 00000000..3201dc06 --- /dev/null +++ b/test/Api/FormControllerApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/GroupControllerApiTest.php b/test/Api/GroupControllerApiTest.php new file mode 100644 index 00000000..32db5145 --- /dev/null +++ b/test/Api/GroupControllerApiTest.php @@ -0,0 +1,182 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createGroup + * + * Create a group. + * + */ + public function testCreateGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteGroup + * + * Delete group. + * + */ + public function testDeleteGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllGroups + * + * Get all Contact Groups in paginated format. + * + */ + public function testGetAllGroups() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getGroup + * + * Get group. + * + */ + public function testGetGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getGroupWithContacts + * + * Get group and contacts belonging to it. + * + */ + public function testGetGroupWithContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getGroupWithContactsPaginated + * + * . + * + */ + public function testGetGroupWithContactsPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getGroups + * + * Get all groups. + * + */ + public function testGetGroups() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for removeContactsFromGroup + * + * Remove contacts from a group. + * + */ + public function testRemoveContactsFromGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/InboxControllerApiTest.php b/test/Api/InboxControllerApiTest.php new file mode 100644 index 00000000..d481a7de --- /dev/null +++ b/test/Api/InboxControllerApiTest.php @@ -0,0 +1,542 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createInbox + * + * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.. + * + */ + public function testCreateInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for createInboxRuleset + * + * Create an inbox ruleset. + * + */ + public function testCreateInboxRuleset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for createInboxWithDefaults + * + * Create an inbox with default options. Uses MailSlurp domain pool address and is private.. + * + */ + public function testCreateInboxWithDefaults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for createInboxWithOptions + * + * Create an inbox with options. Extended options for inbox creation.. + * + */ + public function testCreateInboxWithOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAllInboxEmails + * + * Delete all emails in a given inboxes.. + * + */ + public function testDeleteAllInboxEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAllInboxes + * + * Delete all inboxes. + * + */ + public function testDeleteAllInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteInbox + * + * Delete inbox. + * + */ + public function testDeleteInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for doesInboxExist + * + * Does inbox exist. + * + */ + public function testDoesInboxExist() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for flushExpired + * + * Remove expired inboxes. + * + */ + public function testFlushExpired() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllInboxes + * + * List All Inboxes Paginated. + * + */ + public function testGetAllInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllScheduledJobs + * + * Get all scheduled email sending jobs for account. + * + */ + public function testGetAllScheduledJobs() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getDeliveryStatusesByInboxId + * + * . + * + */ + public function testGetDeliveryStatusesByInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmails + * + * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.. + * + */ + public function testGetEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getImapSmtpAccess + * + * . + * + */ + public function testGetImapSmtpAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInbox + * + * Get Inbox. Returns properties of an inbox.. + * + */ + public function testGetInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxByEmailAddress + * + * Search for an inbox with the provided email address. + * + */ + public function testGetInboxByEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxByName + * + * Search for an inbox with the given name. + * + */ + public function testGetInboxByName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxCount + * + * Get total inbox count. + * + */ + public function testGetInboxCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxEmailCount + * + * Get email count in inbox. + * + */ + public function testGetInboxEmailCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxEmailsPaginated + * + * Get inbox emails paginated. + * + */ + public function testGetInboxEmailsPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxIds + * + * Get all inbox IDs. + * + */ + public function testGetInboxIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxSentEmails + * + * Get Inbox Sent Emails. + * + */ + public function testGetInboxSentEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxTags + * + * Get inbox tags. + * + */ + public function testGetInboxTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxes + * + * List Inboxes and email addresses. + * + */ + public function testGetInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getLatestEmailInInbox + * + * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.. + * + */ + public function testGetLatestEmailInInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getOrganizationInboxes + * + * List Organization Inboxes Paginated. + * + */ + public function testGetOrganizationInboxes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getScheduledJob + * + * Get a scheduled email job. + * + */ + public function testGetScheduledJob() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getScheduledJobsByInboxId + * + * Get all scheduled email sending jobs for the inbox. + * + */ + public function testGetScheduledJobsByInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for listInboxRulesets + * + * List inbox rulesets. + * + */ + public function testListInboxRulesets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for listInboxTrackingPixels + * + * List inbox tracking pixels. + * + */ + public function testListInboxTrackingPixels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendEmail + * + * Send Email. + * + */ + public function testSendEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendEmailAndConfirm + * + * Send email and return sent confirmation. + * + */ + public function testSendEmailAndConfirm() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendEmailWithQueue + * + * Send email with queue. + * + */ + public function testSendEmailWithQueue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendSmtpEnvelope + * + * Send email using an SMTP mail envelope and message body and return sent confirmation. + * + */ + public function testSendSmtpEnvelope() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendTestEmail + * + * Send a test email to inbox. + * + */ + public function testSendTestEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendWithSchedule + * + * Send email with with delay or schedule. + * + */ + public function testSendWithSchedule() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for setInboxFavourited + * + * Set inbox favourited state. + * + */ + public function testSetInboxFavourited() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateInbox + * + * Update Inbox. Change name and description. Email address is not editable.. + * + */ + public function testUpdateInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/InboxForwarderControllerApiTest.php b/test/Api/InboxForwarderControllerApiTest.php new file mode 100644 index 00000000..159a30c9 --- /dev/null +++ b/test/Api/InboxForwarderControllerApiTest.php @@ -0,0 +1,194 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteInboxForwarder + * + * Delete an inbox forwarder. + * + */ + public function testDeleteInboxForwarder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteInboxForwarders + * + * Delete inbox forwarders. + * + */ + public function testDeleteInboxForwarders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxForwarder + * + * Get an inbox forwarder. + * + */ + public function testGetInboxForwarder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxForwarderEvents + * + * Get an inbox forwarder event list. + * + */ + public function testGetInboxForwarderEvents() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxForwarders + * + * List inbox forwarders. + * + */ + public function testGetInboxForwarders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testInboxForwarder + * + * Test an inbox forwarder. + * + */ + public function testTestInboxForwarder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testInboxForwardersForInbox + * + * Test inbox forwarders for inbox. + * + */ + public function testTestInboxForwardersForInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testNewInboxForwarder + * + * Test new inbox forwarder. + * + */ + public function testTestNewInboxForwarder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateInboxForwarder + * + * Update an inbox forwarder. + * + */ + public function testUpdateInboxForwarder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/InboxRulesetControllerApiTest.php b/test/Api/InboxRulesetControllerApiTest.php new file mode 100644 index 00000000..66105963 --- /dev/null +++ b/test/Api/InboxRulesetControllerApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteInboxRuleset + * + * Delete an inbox ruleset. + * + */ + public function testDeleteInboxRuleset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteInboxRulesets + * + * Delete inbox rulesets. + * + */ + public function testDeleteInboxRulesets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxRuleset + * + * Get an inbox ruleset. + * + */ + public function testGetInboxRuleset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxRulesets + * + * List inbox rulesets. + * + */ + public function testGetInboxRulesets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testInboxRuleset + * + * Test an inbox ruleset. + * + */ + public function testTestInboxRuleset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testInboxRulesetsForInbox + * + * Test inbox rulesets for inbox. + * + */ + public function testTestInboxRulesetsForInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testNewInboxRuleset + * + * Test new inbox ruleset. + * + */ + public function testTestNewInboxRuleset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/MailServerControllerApiTest.php b/test/Api/MailServerControllerApiTest.php new file mode 100644 index 00000000..d886afa9 --- /dev/null +++ b/test/Api/MailServerControllerApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getDnsLookup + * + * Lookup DNS records for a domain. + * + */ + public function testGetDnsLookup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getIpAddress + * + * Get IP address for a domain. + * + */ + public function testGetIpAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for verifyEmailAddress + * + * Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server.. + * + */ + public function testVerifyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/MissedEmailControllerApiTest.php b/test/Api/MissedEmailControllerApiTest.php new file mode 100644 index 00000000..8f956836 --- /dev/null +++ b/test/Api/MissedEmailControllerApiTest.php @@ -0,0 +1,134 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllUnknownMissedEmails + * + * Get all unknown missed emails in paginated format. + * + */ + public function testGetAllUnknownMissedEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getMissedEmail + * + * Get MissedEmail. + * + */ + public function testGetMissedEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for restoreMissedEmails + * + * Restore missed emails. + * + */ + public function testRestoreMissedEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForNthMissedEmail + * + * Wait for Nth missed email. + * + */ + public function testWaitForNthMissedEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/PhoneControllerApiTest.php b/test/Api/PhoneControllerApiTest.php new file mode 100644 index 00000000..40468b65 --- /dev/null +++ b/test/Api/PhoneControllerApiTest.php @@ -0,0 +1,182 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteEmergencyAddress + * + * . + * + */ + public function testDeleteEmergencyAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deletePhoneNumber + * + * . + * + */ + public function testDeletePhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmergencyAddress + * + * . + * + */ + public function testGetEmergencyAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getEmergencyAddresses + * + * . + * + */ + public function testGetEmergencyAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPhoneNumber + * + * . + * + */ + public function testGetPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPhoneNumbers + * + * . + * + */ + public function testGetPhoneNumbers() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPhonePlans + * + * . + * + */ + public function testGetPhonePlans() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for testPhoneNumberSendSms + * + * . + * + */ + public function testTestPhoneNumberSendSms() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/SentEmailsControllerApiTest.php b/test/Api/SentEmailsControllerApiTest.php new file mode 100644 index 00000000..ae332371 --- /dev/null +++ b/test/Api/SentEmailsControllerApiTest.php @@ -0,0 +1,266 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteSentEmail + * + * Delete sent email receipt. + * + */ + public function testDeleteSentEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllSentTrackingPixels + * + * . + * + */ + public function testGetAllSentTrackingPixels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getRawSentEmailContents + * + * Get raw sent email string. Returns unparsed raw SMTP message with headers and body.. + * + */ + public function testGetRawSentEmailContents() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getRawSentEmailJson + * + * Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format.. + * + */ + public function testGetRawSentEmailJson() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentDeliveryStatus + * + * . + * + */ + public function testGetSentDeliveryStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentDeliveryStatuses + * + * . + * + */ + public function testGetSentDeliveryStatuses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentDeliveryStatusesBySentId + * + * . + * + */ + public function testGetSentDeliveryStatusesBySentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmail + * + * Get sent email receipt. + * + */ + public function testGetSentEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmailHTMLContent + * + * Get sent email HTML content. + * + */ + public function testGetSentEmailHTMLContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmailPreviewURLs + * + * Get sent email URL for viewing in browser or downloading. + * + */ + public function testGetSentEmailPreviewURLs() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmailTrackingPixels + * + * . + * + */ + public function testGetSentEmailTrackingPixels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmails + * + * Get all sent emails in paginated form. + * + */ + public function testGetSentEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentEmailsWithQueueResults + * + * Get results of email sent with queues in paginated form. + * + */ + public function testGetSentEmailsWithQueueResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSentOrganizationEmails + * + * . + * + */ + public function testGetSentOrganizationEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForDeliveryStatuses + * + * . + * + */ + public function testWaitForDeliveryStatuses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/SmsControllerApiTest.php b/test/Api/SmsControllerApiTest.php new file mode 100644 index 00000000..53b997a3 --- /dev/null +++ b/test/Api/SmsControllerApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteSmsMessages + * + * Delete all SMS messages. + * + */ + public function testDeleteSmsMessages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSmsMessage + * + * Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController.. + * + */ + public function testGetSmsMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getSmsMessagesPaginated + * + * Get all SMS messages in all phone numbers in paginated form. .. + * + */ + public function testGetSmsMessagesPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TemplateControllerApiTest.php b/test/Api/TemplateControllerApiTest.php new file mode 100644 index 00000000..a5981c31 --- /dev/null +++ b/test/Api/TemplateControllerApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteTemplate + * + * Delete email template. + * + */ + public function testDeleteTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllTemplates + * + * List templates. + * + */ + public function testGetAllTemplates() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTemplate + * + * Get template. + * + */ + public function testGetTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTemplatePreviewHtml + * + * Get template preview HTML. + * + */ + public function testGetTemplatePreviewHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTemplatePreviewJson + * + * Get template preview Json. + * + */ + public function testGetTemplatePreviewJson() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTemplates + * + * List templates. + * + */ + public function testGetTemplates() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateTemplate + * + * Update template. + * + */ + public function testUpdateTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TrackingControllerApiTest.php b/test/Api/TrackingControllerApiTest.php new file mode 100644 index 00000000..0f682f0c --- /dev/null +++ b/test/Api/TrackingControllerApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllTrackingPixels + * + * Get tracking pixels. + * + */ + public function testGetAllTrackingPixels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTrackingPixel + * + * Get pixel. + * + */ + public function testGetTrackingPixel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/WaitForControllerApiTest.php b/test/Api/WaitForControllerApiTest.php new file mode 100644 index 00000000..60141291 --- /dev/null +++ b/test/Api/WaitForControllerApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForEmailCount + * + * Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs. + * + */ + public function testWaitForEmailCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForLatestEmail + * + * Fetch inbox's latest email or if empty wait for an email to arrive. + * + */ + public function testWaitForLatestEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForLatestSms + * + * Wait for the latest SMS message to match the provided filter conditions such as body contains keyword.. + * + */ + public function testWaitForLatestSms() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForMatchingEmails + * + * Wait or return list of emails that match simple matching patterns. + * + */ + public function testWaitForMatchingEmails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForMatchingFirstEmail + * + * Wait for or return the first email that matches provided MatchOptions array. + * + */ + public function testWaitForMatchingFirstEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForNthEmail + * + * Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.. + * + */ + public function testWaitForNthEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for waitForSms + * + * Wait for an SMS message to match the provided filter conditions such as body contains keyword.. + * + */ + public function testWaitForSms() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/WebhookControllerApiTest.php b/test/Api/WebhookControllerApiTest.php new file mode 100644 index 00000000..63e6c6bf --- /dev/null +++ b/test/Api/WebhookControllerApiTest.php @@ -0,0 +1,470 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createWebhook + * + * Attach a WebHook URL to an inbox. + * + */ + public function testCreateWebhook() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for createWebhookForPhoneNumber + * + * Attach a WebHook URL to a phone number. + * + */ + public function testCreateWebhookForPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteAllWebhooks + * + * Delete all webhooks. + * + */ + public function testDeleteAllWebhooks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteWebhook + * + * Delete and disable a Webhook for an Inbox. + * + */ + public function testDeleteWebhook() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteWebhookById + * + * Delete a webhook. + * + */ + public function testDeleteWebhookById() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllAccountWebhooks + * + * List account webhooks Paginated. + * + */ + public function testGetAllAccountWebhooks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllWebhookResults + * + * Get results for all webhooks. + * + */ + public function testGetAllWebhookResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllWebhooks + * + * List Webhooks Paginated. + * + */ + public function testGetAllWebhooks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInboxWebhooksPaginated + * + * Get paginated webhooks for an Inbox. + * + */ + public function testGetInboxWebhooksPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getJsonSchemaForWebhookEvent + * + * . + * + */ + public function testGetJsonSchemaForWebhookEvent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getJsonSchemaForWebhookPayload + * + * . + * + */ + public function testGetJsonSchemaForWebhookPayload() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPhoneNumberWebhooksPaginated + * + * Get paginated webhooks for a phone number. + * + */ + public function testGetPhoneNumberWebhooksPaginated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayload + * + * . + * + */ + public function testGetTestWebhookPayload() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadBounce + * + * . + * + */ + public function testGetTestWebhookPayloadBounce() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadBounceRecipient + * + * . + * + */ + public function testGetTestWebhookPayloadBounceRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadDeliveryStatus + * + * Get webhook test payload for delivery status event. + * + */ + public function testGetTestWebhookPayloadDeliveryStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadEmailOpened + * + * . + * + */ + public function testGetTestWebhookPayloadEmailOpened() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadEmailRead + * + * . + * + */ + public function testGetTestWebhookPayloadEmailRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadForWebhook + * + * . + * + */ + public function testGetTestWebhookPayloadForWebhook() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadNewAttachment + * + * Get webhook test payload for new attachment event. + * + */ + public function testGetTestWebhookPayloadNewAttachment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadNewContact + * + * Get webhook test payload for new contact event. + * + */ + public function testGetTestWebhookPayloadNewContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadNewEmail + * + * Get webhook test payload for new email event. + * + */ + public function testGetTestWebhookPayloadNewEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTestWebhookPayloadNewSms + * + * Get webhook test payload for new sms event. + * + */ + public function testGetTestWebhookPayloadNewSms() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getWebhook + * + * Get a webhook. + * + */ + public function testGetWebhook() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getWebhookResult + * + * Get a webhook result for a webhook. + * + */ + public function testGetWebhookResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getWebhookResults + * + * Get a webhook results for a webhook. + * + */ + public function testGetWebhookResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getWebhookResultsUnseenErrorCount + * + * Get count of unseen webhook results with error status. + * + */ + public function testGetWebhookResultsUnseenErrorCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getWebhooks + * + * Get all webhooks for an Inbox. + * + */ + public function testGetWebhooks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for redriveWebhookResult + * + * Get a webhook result and try to resend the original webhook payload. + * + */ + public function testRedriveWebhookResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendTestData + * + * Send webhook test data. + * + */ + public function testSendTestData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateWebhookHeaders + * + * Update a webhook request headers. + * + */ + public function testUpdateWebhookHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for verifyWebhookSignature + * + * Verify a webhook payload signature. + * + */ + public function testVerifyWebhookSignature() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AbstractWebhookPayloadTest.php b/test/Model/AbstractWebhookPayloadTest.php new file mode 100644 index 00000000..efe8376d --- /dev/null +++ b/test/Model/AbstractWebhookPayloadTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AliasDtoTest.php b/test/Model/AliasDtoTest.php new file mode 100644 index 00000000..170d9191 --- /dev/null +++ b/test/Model/AliasDtoTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "masked_email_address" + */ + public function testPropertyMaskedEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_threads" + */ + public function testPropertyUseThreads() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_verified" + */ + public function testPropertyIsVerified() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AliasProjectionTest.php b/test/Model/AliasProjectionTest.php new file mode 100644 index 00000000..1ca5c562 --- /dev/null +++ b/test/Model/AliasProjectionTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_threads" + */ + public function testPropertyUseThreads() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentEntityTest.php b/test/Model/AttachmentEntityTest.php new file mode 100644 index 00000000..d56338b9 --- /dev/null +++ b/test/Model/AttachmentEntityTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_id" + */ + public function testPropertyAttachmentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bucket" + */ + public function testPropertyBucket() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_length" + */ + public function testPropertyContentLength() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentMetaDataTest.php b/test/Model/AttachmentMetaDataTest.php new file mode 100644 index 00000000..535c9bae --- /dev/null +++ b/test/Model/AttachmentMetaDataTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_length" + */ + public function testPropertyContentLength() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentProjectionTest.php b/test/Model/AttachmentProjectionTest.php new file mode 100644 index 00000000..f0950905 --- /dev/null +++ b/test/Model/AttachmentProjectionTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_length" + */ + public function testPropertyContentLength() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_id" + */ + public function testPropertyAttachmentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BasicAuthOptionsTest.php b/test/Model/BasicAuthOptionsTest.php new file mode 100644 index 00000000..ba91879e --- /dev/null +++ b/test/Model/BasicAuthOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BounceProjectionTest.php b/test/Model/BounceProjectionTest.php new file mode 100644 index 00000000..490da731 --- /dev/null +++ b/test/Model/BounceProjectionTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_type" + */ + public function testPropertyBounceType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_mta" + */ + public function testPropertyBounceMta() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BounceRecipientProjectionTest.php b/test/Model/BounceRecipientProjectionTest.php new file mode 100644 index 00000000..edc825de --- /dev/null +++ b/test/Model/BounceRecipientProjectionTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BouncedEmailDtoTest.php b/test/Model/BouncedEmailDtoTest.php new file mode 100644 index 00000000..daffeb37 --- /dev/null +++ b/test/Model/BouncedEmailDtoTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "notification_type" + */ + public function testPropertyNotificationType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_to_recipients" + */ + public function testPropertySentToRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_mta" + */ + public function testPropertyBounceMta() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_type" + */ + public function testPropertyBounceType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_recipients" + */ + public function testPropertyBounceRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_sub_type" + */ + public function testPropertyBounceSubType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BouncedRecipientDtoTest.php b/test/Model/BouncedRecipientDtoTest.php new file mode 100644 index 00000000..c4d2e748 --- /dev/null +++ b/test/Model/BouncedRecipientDtoTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "diagnostic_code" + */ + public function testPropertyDiagnosticCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BulkSendEmailOptionsTest.php b/test/Model/BulkSendEmailOptionsTest.php new file mode 100644 index 00000000..626ef4b5 --- /dev/null +++ b/test/Model/BulkSendEmailOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_ids" + */ + public function testPropertyInboxIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_email_options" + */ + public function testPropertySendEmailOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ComplaintTest.php b/test/Model/ComplaintTest.php new file mode 100644 index 00000000..62336049 --- /dev/null +++ b/test/Model/ComplaintTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mail_source" + */ + public function testPropertyMailSource() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mail_message_id" + */ + public function testPropertyMailMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "complaint_recipient" + */ + public function testPropertyComplaintRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ConditionOptionTest.php b/test/Model/ConditionOptionTest.php new file mode 100644 index 00000000..4eaabeca --- /dev/null +++ b/test/Model/ConditionOptionTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "condition" + */ + public function testPropertyCondition() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactDtoTest.php b/test/Model/ContactDtoTest.php new file mode 100644 index 00000000..b52e4f92 --- /dev/null +++ b/test/Model/ContactDtoTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first_name" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_name" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_addresses" + */ + public function testPropertyEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "primary_email_address" + */ + public function testPropertyPrimaryEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "meta_data" + */ + public function testPropertyMetaData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "opt_out" + */ + public function testPropertyOptOut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactProjectionTest.php b/test/Model/ContactProjectionTest.php new file mode 100644 index 00000000..b99c55e6 --- /dev/null +++ b/test/Model/ContactProjectionTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first_name" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_name" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_addresses" + */ + public function testPropertyEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "opt_out" + */ + public function testPropertyOptOut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContentMatchOptionsTest.php b/test/Model/ContentMatchOptionsTest.php new file mode 100644 index 00000000..a88cf7ee --- /dev/null +++ b/test/Model/ContentMatchOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pattern" + */ + public function testPropertyPattern() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CountDtoTest.php b/test/Model/CountDtoTest.php new file mode 100644 index 00000000..449ae4e1 --- /dev/null +++ b/test/Model/CountDtoTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateAliasOptionsTest.php b/test/Model/CreateAliasOptionsTest.php new file mode 100644 index 00000000..37fb249a --- /dev/null +++ b/test/Model/CreateAliasOptionsTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_threads" + */ + public function testPropertyUseThreads() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateContactOptionsTest.php b/test/Model/CreateContactOptionsTest.php new file mode 100644 index 00000000..ca3afed6 --- /dev/null +++ b/test/Model/CreateContactOptionsTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first_name" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_name" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_addresses" + */ + public function testPropertyEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "meta_data" + */ + public function testPropertyMetaData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "opt_out" + */ + public function testPropertyOptOut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateDomainOptionsTest.php b/test/Model/CreateDomainOptionsTest.php new file mode 100644 index 00000000..5ebc5cb2 --- /dev/null +++ b/test/Model/CreateDomainOptionsTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain" + */ + public function testPropertyDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_catch_all_inbox" + */ + public function testPropertyCreatedCatchAllInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_type" + */ + public function testPropertyDomainType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateEmergencyAddressOptionsTest.php b/test/Model/CreateEmergencyAddressOptionsTest.php new file mode 100644 index 00000000..71c9376f --- /dev/null +++ b/test/Model/CreateEmergencyAddressOptionsTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_name" + */ + public function testPropertyCustomerName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address1" + */ + public function testPropertyAddress1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "region" + */ + public function testPropertyRegion() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "postal_code" + */ + public function testPropertyPostalCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "iso_country_code" + */ + public function testPropertyIsoCountryCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "display_name" + */ + public function testPropertyDisplayName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateGroupOptionsTest.php b/test/Model/CreateGroupOptionsTest.php new file mode 100644 index 00000000..b967938d --- /dev/null +++ b/test/Model/CreateGroupOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateInboxDtoTest.php b/test/Model/CreateInboxDtoTest.php new file mode 100644 index 00000000..00d88677 --- /dev/null +++ b/test/Model/CreateInboxDtoTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_domain_pool" + */ + public function testPropertyUseDomainPool() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "favourite" + */ + public function testPropertyFavourite() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_in" + */ + public function testPropertyExpiresIn() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "allow_team_access" + */ + public function testPropertyAllowTeamAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_type" + */ + public function testPropertyInboxType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_inbox" + */ + public function testPropertyVirtualInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_short_address" + */ + public function testPropertyUseShortAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateInboxForwarderOptionsTest.php b/test/Model/CreateInboxForwarderOptionsTest.php new file mode 100644 index 00000000..c001312a --- /dev/null +++ b/test/Model/CreateInboxForwarderOptionsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "match" + */ + public function testPropertyMatch() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forward_to_recipients" + */ + public function testPropertyForwardToRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateInboxRulesetOptionsTest.php b/test/Model/CreateInboxRulesetOptionsTest.php new file mode 100644 index 00000000..73efad99 --- /dev/null +++ b/test/Model/CreateInboxRulesetOptionsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "scope" + */ + public function testPropertyScope() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "target" + */ + public function testPropertyTarget() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateTemplateOptionsTest.php b/test/Model/CreateTemplateOptionsTest.php new file mode 100644 index 00000000..5fa0b368 --- /dev/null +++ b/test/Model/CreateTemplateOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateTrackingPixelOptionsTest.php b/test/Model/CreateTrackingPixelOptionsTest.php new file mode 100644 index 00000000..5f5c14ee --- /dev/null +++ b/test/Model/CreateTrackingPixelOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateWebhookOptionsTest.php b/test/Model/CreateWebhookOptionsTest.php new file mode 100644 index 00000000..e2588ba3 --- /dev/null +++ b/test/Model/CreateWebhookOptionsTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "basic_auth" + */ + public function testPropertyBasicAuth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "include_headers" + */ + public function testPropertyIncludeHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "request_body_template" + */ + public function testPropertyRequestBodyTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DNSLookupOptionsTest.php b/test/Model/DNSLookupOptionsTest.php new file mode 100644 index 00000000..088483c2 --- /dev/null +++ b/test/Model/DNSLookupOptionsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "hostname" + */ + public function testPropertyHostname() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_types" + */ + public function testPropertyRecordTypes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "omit_final_dns_dot" + */ + public function testPropertyOmitFinalDnsDot() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DNSLookupResultTest.php b/test/Model/DNSLookupResultTest.php new file mode 100644 index 00000000..bca1e7bd --- /dev/null +++ b/test/Model/DNSLookupResultTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_type" + */ + public function testPropertyRecordType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ttl" + */ + public function testPropertyTtl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_entries" + */ + public function testPropertyRecordEntries() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DNSLookupResultsTest.php b/test/Model/DNSLookupResultsTest.php new file mode 100644 index 00000000..6d9f2bba --- /dev/null +++ b/test/Model/DNSLookupResultsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "results" + */ + public function testPropertyResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DeliveryStatusDtoTest.php b/test/Model/DeliveryStatusDtoTest.php new file mode 100644 index 00000000..93e685b9 --- /dev/null +++ b/test/Model/DeliveryStatusDtoTest.php @@ -0,0 +1,208 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_id" + */ + public function testPropertySentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "remote_mta_ip" + */ + public function testPropertyRemoteMtaIp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reporting_mta" + */ + public function testPropertyReportingMta() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipients" + */ + public function testPropertyRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_response" + */ + public function testPropertySmtpResponse() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_status_code" + */ + public function testPropertySmtpStatusCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "processing_time_millis" + */ + public function testPropertyProcessingTimeMillis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "received" + */ + public function testPropertyReceived() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DescribeDomainOptionsTest.php b/test/Model/DescribeDomainOptionsTest.php new file mode 100644 index 00000000..8ca1954c --- /dev/null +++ b/test/Model/DescribeDomainOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain" + */ + public function testPropertyDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DescribeMailServerDomainResultTest.php b/test/Model/DescribeMailServerDomainResultTest.php new file mode 100644 index 00000000..c2b1df71 --- /dev/null +++ b/test/Model/DescribeMailServerDomainResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mx_records" + */ + public function testPropertyMxRecords() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain" + */ + public function testPropertyDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DomainDtoTest.php b/test/Model/DomainDtoTest.php new file mode 100644 index 00000000..e64bed92 --- /dev/null +++ b/test/Model/DomainDtoTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain" + */ + public function testPropertyDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "verification_token" + */ + public function testPropertyVerificationToken() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "dkim_tokens" + */ + public function testPropertyDkimTokens() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_verified" + */ + public function testPropertyIsVerified() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_name_records" + */ + public function testPropertyDomainNameRecords() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "catch_all_inbox_id" + */ + public function testPropertyCatchAllInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_type" + */ + public function testPropertyDomainType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DomainNameRecordTest.php b/test/Model/DomainNameRecordTest.php new file mode 100644 index 00000000..9e70411a --- /dev/null +++ b/test/Model/DomainNameRecordTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_type" + */ + public function testPropertyRecordType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_entries" + */ + public function testPropertyRecordEntries() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ttl" + */ + public function testPropertyTtl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DomainPreviewTest.php b/test/Model/DomainPreviewTest.php new file mode 100644 index 00000000..dd42da5f --- /dev/null +++ b/test/Model/DomainPreviewTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain" + */ + public function testPropertyDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "catch_all_inbox_id" + */ + public function testPropertyCatchAllInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_type" + */ + public function testPropertyDomainType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_verified" + */ + public function testPropertyIsVerified() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DownloadAttachmentDtoTest.php b/test/Model/DownloadAttachmentDtoTest.php new file mode 100644 index 00000000..2b0217bf --- /dev/null +++ b/test/Model/DownloadAttachmentDtoTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "base64_file_contents" + */ + public function testPropertyBase64FileContents() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size_bytes" + */ + public function testPropertySizeBytes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailAnalysisTest.php b/test/Model/EmailAnalysisTest.php new file mode 100644 index 00000000..e838e843 --- /dev/null +++ b/test/Model/EmailAnalysisTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "spam_verdict" + */ + public function testPropertySpamVerdict() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virus_verdict" + */ + public function testPropertyVirusVerdict() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "spf_verdict" + */ + public function testPropertySpfVerdict() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "dkim_verdict" + */ + public function testPropertyDkimVerdict() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "dmarc_verdict" + */ + public function testPropertyDmarcVerdict() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailContentMatchResultTest.php b/test/Model/EmailContentMatchResultTest.php new file mode 100644 index 00000000..37520ff3 --- /dev/null +++ b/test/Model/EmailContentMatchResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pattern" + */ + public function testPropertyPattern() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailHtmlDtoTest.php b/test/Model/EmailHtmlDtoTest.php new file mode 100644 index 00000000..3445d9a8 --- /dev/null +++ b/test/Model/EmailHtmlDtoTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailLinksResultTest.php b/test/Model/EmailLinksResultTest.php new file mode 100644 index 00000000..d02e015f --- /dev/null +++ b/test/Model/EmailLinksResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailPreviewTest.php b/test/Model/EmailPreviewTest.php new file mode 100644 index 00000000..05f0b9a1 --- /dev/null +++ b/test/Model/EmailPreviewTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailPreviewUrlsTest.php b/test/Model/EmailPreviewUrlsTest.php new file mode 100644 index 00000000..0a74972b --- /dev/null +++ b/test/Model/EmailPreviewUrlsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_smtp_message_url" + */ + public function testPropertyRawSmtpMessageUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "plain_html_body_url" + */ + public function testPropertyPlainHtmlBodyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailProjectionTest.php b/test/Model/EmailProjectionTest.php new file mode 100644 index 00000000..f415ae8e --- /dev/null +++ b/test/Model/EmailProjectionTest.php @@ -0,0 +1,208 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_md5_hash" + */ + public function testPropertyBodyMd5Hash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_excerpt" + */ + public function testPropertyBodyExcerpt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "team_access" + */ + public function testPropertyTeamAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailRecipientsTest.php b/test/Model/EmailRecipientsTest.php new file mode 100644 index 00000000..878a41ae --- /dev/null +++ b/test/Model/EmailRecipientsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailTest.php b/test/Model/EmailTest.php new file mode 100644 index 00000000..07cf13f6 --- /dev/null +++ b/test/Model/EmailTest.php @@ -0,0 +1,307 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipients" + */ + public function testPropertyRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reply_to" + */ + public function testPropertyReplyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "headers" + */ + public function testPropertyHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_excerpt" + */ + public function testPropertyBodyExcerpt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_md5_hash" + */ + public function testPropertyBodyMd5Hash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_html" + */ + public function testPropertyIsHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "charset" + */ + public function testPropertyCharset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "analysis" + */ + public function testPropertyAnalysis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "team_access" + */ + public function testPropertyTeamAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailTextLinesResultTest.php b/test/Model/EmailTextLinesResultTest.php new file mode 100644 index 00000000..0e5ecdfa --- /dev/null +++ b/test/Model/EmailTextLinesResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "lines" + */ + public function testPropertyLines() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailValidationRequestDtoTest.php b/test/Model/EmailValidationRequestDtoTest.php new file mode 100644 index 00000000..cf707efa --- /dev/null +++ b/test/Model/EmailValidationRequestDtoTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_valid" + */ + public function testPropertyIsValid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmailVerificationResultTest.php b/test/Model/EmailVerificationResultTest.php new file mode 100644 index 00000000..fc63f4f2 --- /dev/null +++ b/test/Model/EmailVerificationResultTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_name" + */ + public function testPropertyDomainName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "port" + */ + public function testPropertyPort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_valid" + */ + public function testPropertyIsValid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmergencyAddressDtoTest.php b/test/Model/EmergencyAddressDtoTest.php new file mode 100644 index 00000000..4ea88f4f --- /dev/null +++ b/test/Model/EmergencyAddressDtoTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address1" + */ + public function testPropertyAddress1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_country" + */ + public function testPropertyPhoneCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmergencyAddressTest.php b/test/Model/EmergencyAddressTest.php new file mode 100644 index 00000000..ee17a4a4 --- /dev/null +++ b/test/Model/EmergencyAddressTest.php @@ -0,0 +1,199 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sid" + */ + public function testPropertySid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "display_name" + */ + public function testPropertyDisplayName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_name" + */ + public function testPropertyCustomerName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address1" + */ + public function testPropertyAddress1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "region" + */ + public function testPropertyRegion() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "postal_code" + */ + public function testPropertyPostalCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_country" + */ + public function testPropertyPhoneCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_sid" + */ + public function testPropertyAccountSid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EmptyResponseDtoTest.php b/test/Model/EmptyResponseDtoTest.php new file mode 100644 index 00000000..b31e20a3 --- /dev/null +++ b/test/Model/EmptyResponseDtoTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ExpirationDefaultsTest.php b/test/Model/ExpirationDefaultsTest.php new file mode 100644 index 00000000..fc167bf6 --- /dev/null +++ b/test/Model/ExpirationDefaultsTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "default_expiration_millis" + */ + public function testPropertyDefaultExpirationMillis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_expiration_millis" + */ + public function testPropertyMaxExpirationMillis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "default_expires_at" + */ + public function testPropertyDefaultExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "can_permanent_inbox" + */ + public function testPropertyCanPermanentInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "next_inbox_allows_permanent" + */ + public function testPropertyNextInboxAllowsPermanent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ExpiredInboxDtoTest.php b/test/Model/ExpiredInboxDtoTest.php new file mode 100644 index 00000000..b30e5137 --- /dev/null +++ b/test/Model/ExpiredInboxDtoTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ExpiredInboxRecordProjectionTest.php b/test/Model/ExpiredInboxRecordProjectionTest.php new file mode 100644 index 00000000..f2e5b1f3 --- /dev/null +++ b/test/Model/ExpiredInboxRecordProjectionTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ExportLinkTest.php b/test/Model/ExportLinkTest.php new file mode 100644 index 00000000..971e9647 --- /dev/null +++ b/test/Model/ExportLinkTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "download_link" + */ + public function testPropertyDownloadLink() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ExportOptionsTest.php b/test/Model/ExportOptionsTest.php new file mode 100644 index 00000000..82d351be --- /dev/null +++ b/test/Model/ExportOptionsTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "output_format" + */ + public function testPropertyOutputFormat() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "exclude_previously_exported" + */ + public function testPropertyExcludePreviouslyExported() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_earliest_time" + */ + public function testPropertyCreatedEarliestTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_oldest_time" + */ + public function testPropertyCreatedOldestTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "filter" + */ + public function testPropertyFilter() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "list_separator_token" + */ + public function testPropertyListSeparatorToken() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/FilterBouncedRecipientsOptionsTest.php b/test/Model/FilterBouncedRecipientsOptionsTest.php new file mode 100644 index 00000000..a7b4c45d --- /dev/null +++ b/test/Model/FilterBouncedRecipientsOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_recipients" + */ + public function testPropertyEmailRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/FilterBouncedRecipientsResultTest.php b/test/Model/FilterBouncedRecipientsResultTest.php new file mode 100644 index 00000000..098701c4 --- /dev/null +++ b/test/Model/FilterBouncedRecipientsResultTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "filtered_recipients" + */ + public function testPropertyFilteredRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/FlushExpiredInboxesResultTest.php b/test/Model/FlushExpiredInboxesResultTest.php new file mode 100644 index 00000000..10e33ddc --- /dev/null +++ b/test/Model/FlushExpiredInboxesResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_ids" + */ + public function testPropertyInboxIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expire_before" + */ + public function testPropertyExpireBefore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ForwardEmailOptionsTest.php b/test/Model/ForwardEmailOptionsTest.php new file mode 100644 index 00000000..34c81943 --- /dev/null +++ b/test/Model/ForwardEmailOptionsTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_inbox_name" + */ + public function testPropertyUseInboxName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "filter_bounced_recipients" + */ + public function testPropertyFilterBouncedRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GravatarUrlTest.php b/test/Model/GravatarUrlTest.php new file mode 100644 index 00000000..adda07d8 --- /dev/null +++ b/test/Model/GravatarUrlTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "hash" + */ + public function testPropertyHash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupContactsDtoTest.php b/test/Model/GroupContactsDtoTest.php new file mode 100644 index 00000000..2ccbe5a0 --- /dev/null +++ b/test/Model/GroupContactsDtoTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group" + */ + public function testPropertyGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contacts" + */ + public function testPropertyContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupDtoTest.php b/test/Model/GroupDtoTest.php new file mode 100644 index 00000000..2baa265e --- /dev/null +++ b/test/Model/GroupDtoTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupProjectionTest.php b/test/Model/GroupProjectionTest.php new file mode 100644 index 00000000..2f9cd45c --- /dev/null +++ b/test/Model/GroupProjectionTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/HTMLValidationResultTest.php b/test/Model/HTMLValidationResultTest.php new file mode 100644 index 00000000..c947e5cc --- /dev/null +++ b/test/Model/HTMLValidationResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_valid" + */ + public function testPropertyIsValid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "warnings" + */ + public function testPropertyWarnings() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/IPAddressResultTest.php b/test/Model/IPAddressResultTest.php new file mode 100644 index 00000000..4864147e --- /dev/null +++ b/test/Model/IPAddressResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address" + */ + public function testPropertyAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "hostname" + */ + public function testPropertyHostname() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ImapFlagOperationOptionsTest.php b/test/Model/ImapFlagOperationOptionsTest.php new file mode 100644 index 00000000..afea4823 --- /dev/null +++ b/test/Model/ImapFlagOperationOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "flag_operation" + */ + public function testPropertyFlagOperation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "flags" + */ + public function testPropertyFlags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ImapSmtpAccessDetailsTest.php b/test/Model/ImapSmtpAccessDetailsTest.php new file mode 100644 index 00000000..7d2d7129 --- /dev/null +++ b/test/Model/ImapSmtpAccessDetailsTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_server_host" + */ + public function testPropertySmtpServerHost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_server_port" + */ + public function testPropertySmtpServerPort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_username" + */ + public function testPropertySmtpUsername() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_password" + */ + public function testPropertySmtpPassword() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imap_server_host" + */ + public function testPropertyImapServerHost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imap_server_port" + */ + public function testPropertyImapServerPort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imap_username" + */ + public function testPropertyImapUsername() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imap_password" + */ + public function testPropertyImapPassword() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxByEmailAddressResultTest.php b/test/Model/InboxByEmailAddressResultTest.php new file mode 100644 index 00000000..125de0fa --- /dev/null +++ b/test/Model/InboxByEmailAddressResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "exists" + */ + public function testPropertyExists() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxByNameResultTest.php b/test/Model/InboxByNameResultTest.php new file mode 100644 index 00000000..a3ef80e5 --- /dev/null +++ b/test/Model/InboxByNameResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "exists" + */ + public function testPropertyExists() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxDtoTest.php b/test/Model/InboxDtoTest.php new file mode 100644 index 00000000..57d95550 --- /dev/null +++ b/test/Model/InboxDtoTest.php @@ -0,0 +1,199 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "favourite" + */ + public function testPropertyFavourite() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_type" + */ + public function testPropertyInboxType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read_only" + */ + public function testPropertyReadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_inbox" + */ + public function testPropertyVirtualInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxExistsDtoTest.php b/test/Model/InboxExistsDtoTest.php new file mode 100644 index 00000000..155e0067 --- /dev/null +++ b/test/Model/InboxExistsDtoTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "exists" + */ + public function testPropertyExists() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxForwarderDtoTest.php b/test/Model/InboxForwarderDtoTest.php new file mode 100644 index 00000000..08590599 --- /dev/null +++ b/test/Model/InboxForwarderDtoTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "match" + */ + public function testPropertyMatch() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forward_to_recipients" + */ + public function testPropertyForwardToRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxForwarderEventProjectionTest.php b/test/Model/InboxForwarderEventProjectionTest.php new file mode 100644 index 00000000..b82c39cf --- /dev/null +++ b/test/Model/InboxForwarderEventProjectionTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_id" + */ + public function testPropertyEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forwarder_id" + */ + public function testPropertyForwarderId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxForwarderTestOptionsTest.php b/test/Model/InboxForwarderTestOptionsTest.php new file mode 100644 index 00000000..d6eeed7b --- /dev/null +++ b/test/Model/InboxForwarderTestOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "test_value" + */ + public function testPropertyTestValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxForwarderTestResultTest.php b/test/Model/InboxForwarderTestResultTest.php new file mode 100644 index 00000000..e7d109ef --- /dev/null +++ b/test/Model/InboxForwarderTestResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "does_match" + */ + public function testPropertyDoesMatch() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxIdItemTest.php b/test/Model/InboxIdItemTest.php new file mode 100644 index 00000000..05833465 --- /dev/null +++ b/test/Model/InboxIdItemTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxIdsResultTest.php b/test/Model/InboxIdsResultTest.php new file mode 100644 index 00000000..f4e88194 --- /dev/null +++ b/test/Model/InboxIdsResultTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_ids" + */ + public function testPropertyInboxIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxPreviewTest.php b/test/Model/InboxPreviewTest.php new file mode 100644 index 00000000..d0e31969 --- /dev/null +++ b/test/Model/InboxPreviewTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "favourite" + */ + public function testPropertyFavourite() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "team_access" + */ + public function testPropertyTeamAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_type" + */ + public function testPropertyInboxType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_inbox" + */ + public function testPropertyVirtualInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxRulesetDtoTest.php b/test/Model/InboxRulesetDtoTest.php new file mode 100644 index 00000000..6155773a --- /dev/null +++ b/test/Model/InboxRulesetDtoTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "scope" + */ + public function testPropertyScope() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "target" + */ + public function testPropertyTarget() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "handler" + */ + public function testPropertyHandler() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxRulesetTestOptionsTest.php b/test/Model/InboxRulesetTestOptionsTest.php new file mode 100644 index 00000000..a25369bc --- /dev/null +++ b/test/Model/InboxRulesetTestOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "test_target" + */ + public function testPropertyTestTarget() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InboxRulesetTestResultTest.php b/test/Model/InboxRulesetTestResultTest.php new file mode 100644 index 00000000..15a04ca6 --- /dev/null +++ b/test/Model/InboxRulesetTestResultTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ruleset_matches" + */ + public function testPropertyRulesetMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/JSONSchemaDtoTest.php b/test/Model/JSONSchemaDtoTest.php new file mode 100644 index 00000000..c5945299 --- /dev/null +++ b/test/Model/JSONSchemaDtoTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ListUnsubscribeRecipientProjectionTest.php b/test/Model/ListUnsubscribeRecipientProjectionTest.php new file mode 100644 index 00000000..fb18f711 --- /dev/null +++ b/test/Model/ListUnsubscribeRecipientProjectionTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MatchOptionTest.php b/test/Model/MatchOptionTest.php new file mode 100644 index 00000000..c45d2684 --- /dev/null +++ b/test/Model/MatchOptionTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should" + */ + public function testPropertyShould() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MatchOptionsTest.php b/test/Model/MatchOptionsTest.php new file mode 100644 index 00000000..deefe918 --- /dev/null +++ b/test/Model/MatchOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "conditions" + */ + public function testPropertyConditions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MissedEmailDtoTest.php b/test/Model/MissedEmailDtoTest.php new file mode 100644 index 00000000..fd9311da --- /dev/null +++ b/test/Model/MissedEmailDtoTest.php @@ -0,0 +1,226 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_excerpt" + */ + public function testPropertyBodyExcerpt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_count" + */ + public function testPropertyAttachmentCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_url" + */ + public function testPropertyRawUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_key" + */ + public function testPropertyRawKey() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_bucket" + */ + public function testPropertyRawBucket() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "can_restore" + */ + public function testPropertyCanRestore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_ids" + */ + public function testPropertyInboxIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MissedEmailProjectionTest.php b/test/Model/MissedEmailProjectionTest.php new file mode 100644 index 00000000..398fd834 --- /dev/null +++ b/test/Model/MissedEmailProjectionTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/NameServerRecordTest.php b/test/Model/NameServerRecordTest.php new file mode 100644 index 00000000..056da568 --- /dev/null +++ b/test/Model/NameServerRecordTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw" + */ + public function testPropertyRaw() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "record_type" + */ + public function testPropertyRecordType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OrganizationInboxProjectionTest.php b/test/Model/OrganizationInboxProjectionTest.php new file mode 100644 index 00000000..eed2fe58 --- /dev/null +++ b/test/Model/OrganizationInboxProjectionTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "favourite" + */ + public function testPropertyFavourite() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "team_access" + */ + public function testPropertyTeamAccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_type" + */ + public function testPropertyInboxType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read_only" + */ + public function testPropertyReadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_inbox" + */ + public function testPropertyVirtualInbox() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageAliasTest.php b/test/Model/PageAliasTest.php new file mode 100644 index 00000000..cd6385f7 --- /dev/null +++ b/test/Model/PageAliasTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageAttachmentEntityTest.php b/test/Model/PageAttachmentEntityTest.php new file mode 100644 index 00000000..8dcbf978 --- /dev/null +++ b/test/Model/PageAttachmentEntityTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageBouncedEmailTest.php b/test/Model/PageBouncedEmailTest.php new file mode 100644 index 00000000..38ae63cf --- /dev/null +++ b/test/Model/PageBouncedEmailTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageBouncedRecipientsTest.php b/test/Model/PageBouncedRecipientsTest.php new file mode 100644 index 00000000..56a99fb2 --- /dev/null +++ b/test/Model/PageBouncedRecipientsTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageComplaintTest.php b/test/Model/PageComplaintTest.php new file mode 100644 index 00000000..821c1d2e --- /dev/null +++ b/test/Model/PageComplaintTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageContactProjectionTest.php b/test/Model/PageContactProjectionTest.php new file mode 100644 index 00000000..b4af93cc --- /dev/null +++ b/test/Model/PageContactProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageDeliveryStatusTest.php b/test/Model/PageDeliveryStatusTest.php new file mode 100644 index 00000000..4705fdef --- /dev/null +++ b/test/Model/PageDeliveryStatusTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageEmailPreviewTest.php b/test/Model/PageEmailPreviewTest.php new file mode 100644 index 00000000..8e62e0fd --- /dev/null +++ b/test/Model/PageEmailPreviewTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageEmailProjectionTest.php b/test/Model/PageEmailProjectionTest.php new file mode 100644 index 00000000..74010147 --- /dev/null +++ b/test/Model/PageEmailProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageEmailValidationRequestTest.php b/test/Model/PageEmailValidationRequestTest.php new file mode 100644 index 00000000..b5b3e603 --- /dev/null +++ b/test/Model/PageEmailValidationRequestTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageExpiredInboxRecordProjectionTest.php b/test/Model/PageExpiredInboxRecordProjectionTest.php new file mode 100644 index 00000000..5864affe --- /dev/null +++ b/test/Model/PageExpiredInboxRecordProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageGroupProjectionTest.php b/test/Model/PageGroupProjectionTest.php new file mode 100644 index 00000000..14a31961 --- /dev/null +++ b/test/Model/PageGroupProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageInboxForwarderDtoTest.php b/test/Model/PageInboxForwarderDtoTest.php new file mode 100644 index 00000000..1cc43797 --- /dev/null +++ b/test/Model/PageInboxForwarderDtoTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageInboxForwarderEventsTest.php b/test/Model/PageInboxForwarderEventsTest.php new file mode 100644 index 00000000..3f8fcab6 --- /dev/null +++ b/test/Model/PageInboxForwarderEventsTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageInboxProjectionTest.php b/test/Model/PageInboxProjectionTest.php new file mode 100644 index 00000000..f150f17c --- /dev/null +++ b/test/Model/PageInboxProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageInboxRulesetDtoTest.php b/test/Model/PageInboxRulesetDtoTest.php new file mode 100644 index 00000000..2c0587a9 --- /dev/null +++ b/test/Model/PageInboxRulesetDtoTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageListUnsubscribeRecipientsTest.php b/test/Model/PageListUnsubscribeRecipientsTest.php new file mode 100644 index 00000000..5b22cc95 --- /dev/null +++ b/test/Model/PageListUnsubscribeRecipientsTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageMissedEmailProjectionTest.php b/test/Model/PageMissedEmailProjectionTest.php new file mode 100644 index 00000000..f568bea8 --- /dev/null +++ b/test/Model/PageMissedEmailProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageOrganizationInboxProjectionTest.php b/test/Model/PageOrganizationInboxProjectionTest.php new file mode 100644 index 00000000..5915e7ad --- /dev/null +++ b/test/Model/PageOrganizationInboxProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PagePhoneNumberProjectionTest.php b/test/Model/PagePhoneNumberProjectionTest.php new file mode 100644 index 00000000..7cabcc24 --- /dev/null +++ b/test/Model/PagePhoneNumberProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageScheduledJobsTest.php b/test/Model/PageScheduledJobsTest.php new file mode 100644 index 00000000..8ea5e8a0 --- /dev/null +++ b/test/Model/PageScheduledJobsTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageSentEmailProjectionTest.php b/test/Model/PageSentEmailProjectionTest.php new file mode 100644 index 00000000..f9b83952 --- /dev/null +++ b/test/Model/PageSentEmailProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageSentEmailWithQueueProjectionTest.php b/test/Model/PageSentEmailWithQueueProjectionTest.php new file mode 100644 index 00000000..abe74b3e --- /dev/null +++ b/test/Model/PageSentEmailWithQueueProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageSmsProjectionTest.php b/test/Model/PageSmsProjectionTest.php new file mode 100644 index 00000000..f39edc78 --- /dev/null +++ b/test/Model/PageSmsProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageTemplateProjectionTest.php b/test/Model/PageTemplateProjectionTest.php new file mode 100644 index 00000000..444b9ba7 --- /dev/null +++ b/test/Model/PageTemplateProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageThreadProjectionTest.php b/test/Model/PageThreadProjectionTest.php new file mode 100644 index 00000000..31c472fa --- /dev/null +++ b/test/Model/PageThreadProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageTrackingPixelProjectionTest.php b/test/Model/PageTrackingPixelProjectionTest.php new file mode 100644 index 00000000..3b9f555d --- /dev/null +++ b/test/Model/PageTrackingPixelProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageUnknownMissedEmailProjectionTest.php b/test/Model/PageUnknownMissedEmailProjectionTest.php new file mode 100644 index 00000000..256450b1 --- /dev/null +++ b/test/Model/PageUnknownMissedEmailProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageWebhookProjectionTest.php b/test/Model/PageWebhookProjectionTest.php new file mode 100644 index 00000000..28d6890a --- /dev/null +++ b/test/Model/PageWebhookProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageWebhookResultTest.php b/test/Model/PageWebhookResultTest.php new file mode 100644 index 00000000..cfca2fd7 --- /dev/null +++ b/test/Model/PageWebhookResultTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pageable" + */ + public function testPropertyPageable() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total" + */ + public function testPropertyTotal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "size" + */ + public function testPropertySize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number_of_elements" + */ + public function testPropertyNumberOfElements() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PageableObjectTest.php b/test/Model/PageableObjectTest.php new file mode 100644 index 00000000..2558a8df --- /dev/null +++ b/test/Model/PageableObjectTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "offset" + */ + public function testPropertyOffset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort" + */ + public function testPropertySort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "page_number" + */ + public function testPropertyPageNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "page_size" + */ + public function testPropertyPageSize() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "paged" + */ + public function testPropertyPaged() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "unpaged" + */ + public function testPropertyUnpaged() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PhoneNumberDtoTest.php b/test/Model/PhoneNumberDtoTest.php new file mode 100644 index 00000000..86531c70 --- /dev/null +++ b/test/Model/PhoneNumberDtoTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "compliance_address" + */ + public function testPropertyComplianceAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "emergency_address" + */ + public function testPropertyEmergencyAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_country" + */ + public function testPropertyPhoneCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_plan" + */ + public function testPropertyPhonePlan() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PhoneNumberProjectionTest.php b/test/Model/PhoneNumberProjectionTest.php new file mode 100644 index 00000000..0673e453 --- /dev/null +++ b/test/Model/PhoneNumberProjectionTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_country" + */ + public function testPropertyPhoneCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PhonePlanDtoTest.php b/test/Model/PhonePlanDtoTest.php new file mode 100644 index 00000000..34fe18d6 --- /dev/null +++ b/test/Model/PhonePlanDtoTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_country" + */ + public function testPropertyPhoneCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RawEmailJsonTest.php b/test/Model/RawEmailJsonTest.php new file mode 100644 index 00000000..54af071e --- /dev/null +++ b/test/Model/RawEmailJsonTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RecipientTest.php b/test/Model/RecipientTest.php new file mode 100644 index 00000000..1e1af2d3 --- /dev/null +++ b/test/Model/RecipientTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_value" + */ + public function testPropertyRawValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ReplyToAliasEmailOptionsTest.php b/test/Model/ReplyToAliasEmailOptionsTest.php new file mode 100644 index 00000000..fca85432 --- /dev/null +++ b/test/Model/ReplyToAliasEmailOptionsTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_html" + */ + public function testPropertyIsHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "charset" + */ + public function testPropertyCharset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template_variables" + */ + public function testPropertyTemplateVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template" + */ + public function testPropertyTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_strategy" + */ + public function testPropertySendStrategy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_inbox_name" + */ + public function testPropertyUseInboxName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ReplyToEmailOptionsTest.php b/test/Model/ReplyToEmailOptionsTest.php new file mode 100644 index 00000000..2ca93df8 --- /dev/null +++ b/test/Model/ReplyToEmailOptionsTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_html" + */ + public function testPropertyIsHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reply_to" + */ + public function testPropertyReplyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "charset" + */ + public function testPropertyCharset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template_variables" + */ + public function testPropertyTemplateVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template" + */ + public function testPropertyTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_strategy" + */ + public function testPropertySendStrategy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_inbox_name" + */ + public function testPropertyUseInboxName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ScheduledJobDtoTest.php b/test/Model/ScheduledJobDtoTest.php new file mode 100644 index 00000000..4b631342 --- /dev/null +++ b/test/Model/ScheduledJobDtoTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "job_id" + */ + public function testPropertyJobId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "trigger_id" + */ + public function testPropertyTriggerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_at_timestamp" + */ + public function testPropertySendAtTimestamp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ScheduledJobTest.php b/test/Model/ScheduledJobTest.php new file mode 100644 index 00000000..7e282180 --- /dev/null +++ b/test/Model/ScheduledJobTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "job_id" + */ + public function testPropertyJobId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "trigger_id" + */ + public function testPropertyTriggerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_at_timestamp" + */ + public function testPropertySendAtTimestamp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SendEmailOptionsTest.php b/test/Model/SendEmailOptionsTest.php new file mode 100644 index 00000000..0eac7831 --- /dev/null +++ b/test/Model/SendEmailOptionsTest.php @@ -0,0 +1,262 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to_contacts" + */ + public function testPropertyToContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to_group" + */ + public function testPropertyToGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reply_to" + */ + public function testPropertyReplyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_html" + */ + public function testPropertyIsHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "charset" + */ + public function testPropertyCharset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template_variables" + */ + public function testPropertyTemplateVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template" + */ + public function testPropertyTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "send_strategy" + */ + public function testPropertySendStrategy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "use_inbox_name" + */ + public function testPropertyUseInboxName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "add_tracking_pixel" + */ + public function testPropertyAddTrackingPixel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "filter_bounced_recipients" + */ + public function testPropertyFilterBouncedRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validate_email_addresses" + */ + public function testPropertyValidateEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SendSMTPEnvelopeOptionsTest.php b/test/Model/SendSMTPEnvelopeOptionsTest.php new file mode 100644 index 00000000..b05614fc --- /dev/null +++ b/test/Model/SendSMTPEnvelopeOptionsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "rcpt_to" + */ + public function testPropertyRcptTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mail_from" + */ + public function testPropertyMailFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SendWithQueueResultTest.php b/test/Model/SendWithQueueResultTest.php new file mode 100644 index 00000000..fbb026fe --- /dev/null +++ b/test/Model/SendWithQueueResultTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "header_id" + */ + public function testPropertyHeaderId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "delivered" + */ + public function testPropertyDelivered() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "exception_name" + */ + public function testPropertyExceptionName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SenderTest.php b/test/Model/SenderTest.php new file mode 100644 index 00000000..1cedec63 --- /dev/null +++ b/test/Model/SenderTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "raw_value" + */ + public function testPropertyRawValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SentEmailDtoTest.php b/test/Model/SentEmailDtoTest.php new file mode 100644 index 00000000..8975f313 --- /dev/null +++ b/test/Model/SentEmailDtoTest.php @@ -0,0 +1,307 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reply_to" + */ + public function testPropertyReplyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_md5_hash" + */ + public function testPropertyBodyMd5Hash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to_contacts" + */ + public function testPropertyToContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to_group" + */ + public function testPropertyToGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "charset" + */ + public function testPropertyCharset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_html" + */ + public function testPropertyIsHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_at" + */ + public function testPropertySentAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pixel_ids" + */ + public function testPropertyPixelIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_ids" + */ + public function testPropertyMessageIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_send" + */ + public function testPropertyVirtualSend() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template_id" + */ + public function testPropertyTemplateId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "template_variables" + */ + public function testPropertyTemplateVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SentEmailProjectionTest.php b/test/Model/SentEmailProjectionTest.php new file mode 100644 index 00000000..c5b200c1 --- /dev/null +++ b/test/Model/SentEmailProjectionTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachments" + */ + public function testPropertyAttachments() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body_md5_hash" + */ + public function testPropertyBodyMd5Hash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_send" + */ + public function testPropertyVirtualSend() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SetInboxFavouritedOptionsTest.php b/test/Model/SetInboxFavouritedOptionsTest.php new file mode 100644 index 00000000..90a08227 --- /dev/null +++ b/test/Model/SetInboxFavouritedOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SimpleSendEmailOptionsTest.php b/test/Model/SimpleSendEmailOptionsTest.php new file mode 100644 index 00000000..2b27539f --- /dev/null +++ b/test/Model/SimpleSendEmailOptionsTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender_id" + */ + public function testPropertySenderId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SmsDtoTest.php b/test/Model/SmsDtoTest.php new file mode 100644 index 00000000..3cbb74d4 --- /dev/null +++ b/test/Model/SmsDtoTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from_number" + */ + public function testPropertyFromNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SmsMatchOptionTest.php b/test/Model/SmsMatchOptionTest.php new file mode 100644 index 00000000..4bf07a67 --- /dev/null +++ b/test/Model/SmsMatchOptionTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should" + */ + public function testPropertyShould() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SmsPreviewTest.php b/test/Model/SmsPreviewTest.php new file mode 100644 index 00000000..ed48e4ac --- /dev/null +++ b/test/Model/SmsPreviewTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from_number" + */ + public function testPropertyFromNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SmsProjectionTest.php b/test/Model/SmsProjectionTest.php new file mode 100644 index 00000000..279607dd --- /dev/null +++ b/test/Model/SmsProjectionTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from_number" + */ + public function testPropertyFromNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SortTest.php b/test/Model/SortTest.php new file mode 100644 index 00000000..ad158307 --- /dev/null +++ b/test/Model/SortTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "empty" + */ + public function testPropertyEmpty() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sorted" + */ + public function testPropertySorted() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "unsorted" + */ + public function testPropertyUnsorted() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TemplateDtoTest.php b/test/Model/TemplateDtoTest.php new file mode 100644 index 00000000..9f8090fe --- /dev/null +++ b/test/Model/TemplateDtoTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "variables" + */ + public function testPropertyVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TemplatePreviewTest.php b/test/Model/TemplatePreviewTest.php new file mode 100644 index 00000000..832d6d7a --- /dev/null +++ b/test/Model/TemplatePreviewTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "preview" + */ + public function testPropertyPreview() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TemplateProjectionTest.php b/test/Model/TemplateProjectionTest.php new file mode 100644 index 00000000..c224805a --- /dev/null +++ b/test/Model/TemplateProjectionTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "variables" + */ + public function testPropertyVariables() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TemplateVariableTest.php b/test/Model/TemplateVariableTest.php new file mode 100644 index 00000000..ce5b1be8 --- /dev/null +++ b/test/Model/TemplateVariableTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "variable_type" + */ + public function testPropertyVariableType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TestNewInboxForwarderOptionsTest.php b/test/Model/TestNewInboxForwarderOptionsTest.php new file mode 100644 index 00000000..bb504113 --- /dev/null +++ b/test/Model/TestNewInboxForwarderOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_forwarder_test_options" + */ + public function testPropertyInboxForwarderTestOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "create_inbox_forwarder_options" + */ + public function testPropertyCreateInboxForwarderOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TestNewInboxRulesetOptionsTest.php b/test/Model/TestNewInboxRulesetOptionsTest.php new file mode 100644 index 00000000..99cfc5a4 --- /dev/null +++ b/test/Model/TestNewInboxRulesetOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_ruleset_test_options" + */ + public function testPropertyInboxRulesetTestOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "create_inbox_ruleset_options" + */ + public function testPropertyCreateInboxRulesetOptions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TestPhoneNumberOptionsTest.php b/test/Model/TestPhoneNumberOptionsTest.php new file mode 100644 index 00000000..b870e762 --- /dev/null +++ b/test/Model/TestPhoneNumberOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ThreadProjectionTest.php b/test/Model/ThreadProjectionTest.php new file mode 100644 index 00000000..5ec63f99 --- /dev/null +++ b/test/Model/ThreadProjectionTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alias_id" + */ + public function testPropertyAliasId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TrackingPixelDtoTest.php b/test/Model/TrackingPixelDtoTest.php new file mode 100644 index 00000000..0a309cfd --- /dev/null +++ b/test/Model/TrackingPixelDtoTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "seen" + */ + public function testPropertySeen() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "seen_at" + */ + public function testPropertySeenAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TrackingPixelProjectionTest.php b/test/Model/TrackingPixelProjectionTest.php new file mode 100644 index 00000000..68f0c637 --- /dev/null +++ b/test/Model/TrackingPixelProjectionTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "seen" + */ + public function testPropertySeen() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "seen_at" + */ + public function testPropertySeenAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UnknownMissedEmailProjectionTest.php b/test/Model/UnknownMissedEmailProjectionTest.php new file mode 100644 index 00000000..ddba77d4 --- /dev/null +++ b/test/Model/UnknownMissedEmailProjectionTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UnreadCountTest.php b/test/Model/UnreadCountTest.php new file mode 100644 index 00000000..839feb8b --- /dev/null +++ b/test/Model/UnreadCountTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count" + */ + public function testPropertyCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UnseenErrorCountDtoTest.php b/test/Model/UnseenErrorCountDtoTest.php new file mode 100644 index 00000000..692ae894 --- /dev/null +++ b/test/Model/UnseenErrorCountDtoTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count" + */ + public function testPropertyCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UpdateAliasOptionsTest.php b/test/Model/UpdateAliasOptionsTest.php new file mode 100644 index 00000000..c0cd3b0e --- /dev/null +++ b/test/Model/UpdateAliasOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UpdateDomainOptionsTest.php b/test/Model/UpdateDomainOptionsTest.php new file mode 100644 index 00000000..ea3b8bec --- /dev/null +++ b/test/Model/UpdateDomainOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "catch_all_inbox_id" + */ + public function testPropertyCatchAllInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UpdateGroupContactsTest.php b/test/Model/UpdateGroupContactsTest.php new file mode 100644 index 00000000..2d2fec2c --- /dev/null +++ b/test/Model/UpdateGroupContactsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contact_ids" + */ + public function testPropertyContactIds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UpdateInboxOptionsTest.php b/test/Model/UpdateInboxOptionsTest.php new file mode 100644 index 00000000..bba043c5 --- /dev/null +++ b/test/Model/UpdateInboxOptionsTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "favourite" + */ + public function testPropertyFavourite() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UploadAttachmentBytesRequestTest.php b/test/Model/UploadAttachmentBytesRequestTest.php new file mode 100644 index 00000000..8c3d76cd --- /dev/null +++ b/test/Model/UploadAttachmentBytesRequestTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "short" + */ + public function testPropertyShort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "char" + */ + public function testPropertyChar() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "int" + */ + public function testPropertyInt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "long" + */ + public function testPropertyLong() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "float" + */ + public function testPropertyFloat() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "double" + */ + public function testPropertyDouble() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "direct" + */ + public function testPropertyDirect() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read_only" + */ + public function testPropertyReadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UploadAttachmentOptionsTest.php b/test/Model/UploadAttachmentOptionsTest.php new file mode 100644 index 00000000..3a837b16 --- /dev/null +++ b/test/Model/UploadAttachmentOptionsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "filename" + */ + public function testPropertyFilename() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "base64_contents" + */ + public function testPropertyBase64Contents() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UploadMultipartFormRequestTest.php b/test/Model/UploadMultipartFormRequestTest.php new file mode 100644 index 00000000..5bfdc6b1 --- /dev/null +++ b/test/Model/UploadMultipartFormRequestTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type_header" + */ + public function testPropertyContentTypeHeader() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "file" + */ + public function testPropertyFile() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UserInfoDtoTest.php b/test/Model/UserInfoDtoTest.php new file mode 100644 index 00000000..2734c1f5 --- /dev/null +++ b/test/Model/UserInfoDtoTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_state" + */ + public function testPropertyAccountState() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subscription_type" + */ + public function testPropertySubscriptionType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_type" + */ + public function testPropertyAccountType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ValidateEmailAddressListOptionsTest.php b/test/Model/ValidateEmailAddressListOptionsTest.php new file mode 100644 index 00000000..f527cd02 --- /dev/null +++ b/test/Model/ValidateEmailAddressListOptionsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address_list" + */ + public function testPropertyEmailAddressList() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ValidateEmailAddressListResultTest.php b/test/Model/ValidateEmailAddressListResultTest.php new file mode 100644 index 00000000..1908b388 --- /dev/null +++ b/test/Model/ValidateEmailAddressListResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "valid_email_addresses" + */ + public function testPropertyValidEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invalid_email_addresses" + */ + public function testPropertyInvalidEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "result_map_email_address_is_valid" + */ + public function testPropertyResultMapEmailAddressIsValid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ValidationDtoTest.php b/test/Model/ValidationDtoTest.php new file mode 100644 index 00000000..bcd3de78 --- /dev/null +++ b/test/Model/ValidationDtoTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_id" + */ + public function testPropertyEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "html" + */ + public function testPropertyHtml() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ValidationMessageTest.php b/test/Model/ValidationMessageTest.php new file mode 100644 index 00000000..3774ec67 --- /dev/null +++ b/test/Model/ValidationMessageTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "line_number" + */ + public function testPropertyLineNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VerifyEmailAddressOptionsTest.php b/test/Model/VerifyEmailAddressOptionsTest.php new file mode 100644 index 00000000..1ebe64bc --- /dev/null +++ b/test/Model/VerifyEmailAddressOptionsTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mail_server_domain" + */ + public function testPropertyMailServerDomain() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_address" + */ + public function testPropertyEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender_email_address" + */ + public function testPropertySenderEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "port" + */ + public function testPropertyPort() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VerifyWebhookSignatureOptionsTest.php b/test/Model/VerifyWebhookSignatureOptionsTest.php new file mode 100644 index 00000000..d0bbe7cd --- /dev/null +++ b/test/Model/VerifyWebhookSignatureOptionsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "signature" + */ + public function testPropertySignature() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VerifyWebhookSignatureResultsTest.php b/test/Model/VerifyWebhookSignatureResultsTest.php new file mode 100644 index 00000000..5c832b83 --- /dev/null +++ b/test/Model/VerifyWebhookSignatureResultsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_valid" + */ + public function testPropertyIsValid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WaitForConditionsTest.php b/test/Model/WaitForConditionsTest.php new file mode 100644 index 00000000..3e6d1b16 --- /dev/null +++ b/test/Model/WaitForConditionsTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count" + */ + public function testPropertyCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "delay_timeout" + */ + public function testPropertyDelayTimeout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "timeout" + */ + public function testPropertyTimeout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "unread_only" + */ + public function testPropertyUnreadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count_type" + */ + public function testPropertyCountType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort_direction" + */ + public function testPropertySortDirection() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "since" + */ + public function testPropertySince() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "before" + */ + public function testPropertyBefore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WaitForSingleSmsOptionsTest.php b/test/Model/WaitForSingleSmsOptionsTest.php new file mode 100644 index 00000000..10d21b4c --- /dev/null +++ b/test/Model/WaitForSingleSmsOptionsTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number_id" + */ + public function testPropertyPhoneNumberId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "timeout" + */ + public function testPropertyTimeout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "unread_only" + */ + public function testPropertyUnreadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "before" + */ + public function testPropertyBefore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "since" + */ + public function testPropertySince() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort_direction" + */ + public function testPropertySortDirection() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "delay" + */ + public function testPropertyDelay() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WaitForSmsConditionsTest.php b/test/Model/WaitForSmsConditionsTest.php new file mode 100644 index 00000000..0cfd6cf2 --- /dev/null +++ b/test/Model/WaitForSmsConditionsTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number_id" + */ + public function testPropertyPhoneNumberId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "limit" + */ + public function testPropertyLimit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count" + */ + public function testPropertyCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "delay_timeout" + */ + public function testPropertyDelayTimeout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "timeout" + */ + public function testPropertyTimeout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "unread_only" + */ + public function testPropertyUnreadOnly() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "count_type" + */ + public function testPropertyCountType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "matches" + */ + public function testPropertyMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sort_direction" + */ + public function testPropertySortDirection() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "since" + */ + public function testPropertySince() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "before" + */ + public function testPropertyBefore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookBouncePayloadTest.php b/test/Model/WebhookBouncePayloadTest.php new file mode 100644 index 00000000..c4eccb88 --- /dev/null +++ b/test/Model/WebhookBouncePayloadTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_id" + */ + public function testPropertyBounceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_to_recipients" + */ + public function testPropertySentToRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bounce_recipients" + */ + public function testPropertyBounceRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookBounceRecipientPayloadTest.php b/test/Model/WebhookBounceRecipientPayloadTest.php new file mode 100644 index 00000000..582ebf80 --- /dev/null +++ b/test/Model/WebhookBounceRecipientPayloadTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookDeliveryStatusPayloadTest.php b/test/Model/WebhookDeliveryStatusPayloadTest.php new file mode 100644 index 00000000..ea1012ef --- /dev/null +++ b/test/Model/WebhookDeliveryStatusPayloadTest.php @@ -0,0 +1,226 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_id" + */ + public function testPropertySentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "remote_mta_ip" + */ + public function testPropertyRemoteMtaIp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reporting_mta" + */ + public function testPropertyReportingMta() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipients" + */ + public function testPropertyRecipients() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_response" + */ + public function testPropertySmtpResponse() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "smtp_status_code" + */ + public function testPropertySmtpStatusCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "processing_time_millis" + */ + public function testPropertyProcessingTimeMillis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "received" + */ + public function testPropertyReceived() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookDtoTest.php b/test/Model/WebhookDtoTest.php new file mode 100644 index 00000000..d09c9c1f --- /dev/null +++ b/test/Model/WebhookDtoTest.php @@ -0,0 +1,208 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "basic_auth" + */ + public function testPropertyBasicAuth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_id" + */ + public function testPropertyPhoneId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "request_body_template" + */ + public function testPropertyRequestBodyTemplate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payload_json_schema" + */ + public function testPropertyPayloadJsonSchema() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "request_headers" + */ + public function testPropertyRequestHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookEmailOpenedPayloadTest.php b/test/Model/WebhookEmailOpenedPayloadTest.php new file mode 100644 index 00000000..299face1 --- /dev/null +++ b/test/Model/WebhookEmailOpenedPayloadTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "pixel_id" + */ + public function testPropertyPixelId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sent_email_id" + */ + public function testPropertySentEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "recipient" + */ + public function testPropertyRecipient() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookEmailReadPayloadTest.php b/test/Model/WebhookEmailReadPayloadTest.php new file mode 100644 index 00000000..1f971a23 --- /dev/null +++ b/test/Model/WebhookEmailReadPayloadTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_id" + */ + public function testPropertyEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_is_read" + */ + public function testPropertyEmailIsRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookHeaderNameValueTest.php b/test/Model/WebhookHeaderNameValueTest.php new file mode 100644 index 00000000..ce57b795 --- /dev/null +++ b/test/Model/WebhookHeaderNameValueTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookHeadersTest.php b/test/Model/WebhookHeadersTest.php new file mode 100644 index 00000000..24bb9671 --- /dev/null +++ b/test/Model/WebhookHeadersTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "headers" + */ + public function testPropertyHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookNewAttachmentPayloadTest.php b/test/Model/WebhookNewAttachmentPayloadTest.php new file mode 100644 index 00000000..666f74bf --- /dev/null +++ b/test/Model/WebhookNewAttachmentPayloadTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_id" + */ + public function testPropertyAttachmentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_length" + */ + public function testPropertyContentLength() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookNewContactPayloadTest.php b/test/Model/WebhookNewContactPayloadTest.php new file mode 100644 index 00000000..eeb8ae01 --- /dev/null +++ b/test/Model/WebhookNewContactPayloadTest.php @@ -0,0 +1,217 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contact_id" + */ + public function testPropertyContactId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group_id" + */ + public function testPropertyGroupId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "first_name" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_name" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "primary_email_address" + */ + public function testPropertyPrimaryEmailAddress() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_addresses" + */ + public function testPropertyEmailAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "tags" + */ + public function testPropertyTags() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "meta_data" + */ + public function testPropertyMetaData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "opt_out" + */ + public function testPropertyOptOut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookNewEmailPayloadTest.php b/test/Model/WebhookNewEmailPayloadTest.php new file mode 100644 index 00000000..3051bff7 --- /dev/null +++ b/test/Model/WebhookNewEmailPayloadTest.php @@ -0,0 +1,208 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "domain_id" + */ + public function testPropertyDomainId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_id" + */ + public function testPropertyEmailId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cc" + */ + public function testPropertyCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bcc" + */ + public function testPropertyBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "subject" + */ + public function testPropertySubject() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_meta_datas" + */ + public function testPropertyAttachmentMetaDatas() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookNewSmsPayloadTest.php b/test/Model/WebhookNewSmsPayloadTest.php new file mode 100644 index 00000000..2a7a64c2 --- /dev/null +++ b/test/Model/WebhookNewSmsPayloadTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_name" + */ + public function testPropertyWebhookName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sms_id" + */ + public function testPropertySmsId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to_number" + */ + public function testPropertyToNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "from_number" + */ + public function testPropertyFromNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "read" + */ + public function testPropertyRead() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookProjectionTest.php b/test/Model/WebhookProjectionTest.php new file mode 100644 index 00000000..3e3f213b --- /dev/null +++ b/test/Model/WebhookProjectionTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "event_name" + */ + public function testPropertyEventName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number_id" + */ + public function testPropertyPhoneNumberId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookRedriveResultTest.php b/test/Model/WebhookRedriveResultTest.php new file mode 100644 index 00000000..86a42c4f --- /dev/null +++ b/test/Model/WebhookRedriveResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_result_id" + */ + public function testPropertyWebhookResultId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success" + */ + public function testPropertySuccess() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookResultDtoTest.php b/test/Model/WebhookResultDtoTest.php new file mode 100644 index 00000000..dcc83579 --- /dev/null +++ b/test/Model/WebhookResultDtoTest.php @@ -0,0 +1,226 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "inbox_id" + */ + public function testPropertyInboxId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_id" + */ + public function testPropertyWebhookId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_url" + */ + public function testPropertyWebhookUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "redrive_id" + */ + public function testPropertyRedriveId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "http_method" + */ + public function testPropertyHttpMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "webhook_event" + */ + public function testPropertyWebhookEvent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "response_status" + */ + public function testPropertyResponseStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "response_time_millis" + */ + public function testPropertyResponseTimeMillis() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "response_body_extract" + */ + public function testPropertyResponseBodyExtract() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "result_type" + */ + public function testPropertyResultType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "seen" + */ + public function testPropertySeen() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookTestRequestTest.php b/test/Model/WebhookTestRequestTest.php new file mode 100644 index 00000000..7b8daf37 --- /dev/null +++ b/test/Model/WebhookTestRequestTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "headers" + */ + public function testPropertyHeaders() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payload" + */ + public function testPropertyPayload() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookTestResponseTest.php b/test/Model/WebhookTestResponseTest.php new file mode 100644 index 00000000..8faaa45c --- /dev/null +++ b/test/Model/WebhookTestResponseTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status_code" + */ + public function testPropertyStatusCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WebhookTestResultTest.php b/test/Model/WebhookTestResultTest.php new file mode 100644 index 00000000..137bd268 --- /dev/null +++ b/test/Model/WebhookTestResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "response" + */ + public function testPropertyResponse() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "request" + */ + public function testPropertyRequest() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +}